org.openimaj.math.matrix.similarity.processor

## Class MultidimensionalScaling

• java.lang.Object
• org.openimaj.math.matrix.similarity.processor.MultidimensionalScaling
• All Implemented Interfaces:
SimilarityMatrixProcessor

```public class MultidimensionalScaling
extends Object
implements SimilarityMatrixProcessor```
Implementation of Multidimensional Scaling.

Implementation originally based around Toby Segaran's python code.

Author:
Jonathon Hare (jsh2@ecs.soton.ac.uk)
"http://blog.kiwitobes.com/?p=44"
• ### Field Summary

Fields
Modifier and Type Field and Description
`protected int` `numIterations`
`protected List<IndependentPair<String,Point2d>>` `points`
`protected double` `rate`
`protected Random` `rng`
• ### Constructor Summary

Constructors
Constructor and Description
`MultidimensionalScaling()`
Default constructor.
```MultidimensionalScaling(int numIterations, double rate)```
Construct MDS with the given maximum number of iterations and rate.
```MultidimensionalScaling(int numIterations, double rate, Random rng)```
Construct MDS with the given maximum number of iterations, rate and random number generator.
`MultidimensionalScaling(Random rng)`
Construct with the given random number generator and default learning rate at 0.01 and the maximum number of iterations to 1000.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`Point2d` `getPoint(String key)`
Get the predicted point for a specific element.
`List<IndependentPair<String,Point2d>>` `getPoints()`
Get a list of the 2-D coordinates learned by the MDS algorithm for each element in the input similarity matrix.
`void` `process(SimilarityMatrix matrix)`
Process the `SimilarityMatrix`, making changes inplace.
`String` `toString()`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Field Detail

• #### rng

`protected Random rng`
• #### numIterations

`protected int numIterations`
• #### rate

`protected double rate`
• #### points

`protected List<IndependentPair<String,Point2d>> points`
• ### Constructor Detail

• #### MultidimensionalScaling

`public MultidimensionalScaling()`
Default constructor. Sets the learning rate at 0.01 and the maximum number of iterations to 1000.
• #### MultidimensionalScaling

`public MultidimensionalScaling(Random rng)`
Construct with the given random number generator and default learning rate at 0.01 and the maximum number of iterations to 1000.
Parameters:
`rng` - the random number generator
• #### MultidimensionalScaling

```public MultidimensionalScaling(int numIterations,
double rate)```
Construct MDS with the given maximum number of iterations and rate.
Parameters:
`numIterations` - number of iterations
`rate` - learning rate
• #### MultidimensionalScaling

```public MultidimensionalScaling(int numIterations,
double rate,
Random rng)```
Construct MDS with the given maximum number of iterations, rate and random number generator.
Parameters:
`numIterations` - number of iterations
`rate` - learning rate
`rng` - the random number generator
• ### Method Detail

• #### process

`public void process(SimilarityMatrix matrix)`
Description copied from interface: `SimilarityMatrixProcessor`
Process the `SimilarityMatrix`, making changes inplace.
Specified by:
`process` in interface `SimilarityMatrixProcessor`
Parameters:
`matrix` - the matrix to process.
• #### getPoints

`public List<IndependentPair<String,Point2d>> getPoints()`
Get a list of the 2-D coordinates learned by the MDS algorithm for each element in the input similarity matrix.
Returns:
list of <index, point>
• #### getPoint

`public Point2d getPoint(String key)`
Get the predicted point for a specific element.
Parameters:
`key` - the element identifier
Returns:
`public String toString()`
`toString` in class `Object`