jsat.datatransform.visualization
Class MDS
- java.lang.Object
-
- jsat.datatransform.visualization.MDS
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, VisualizationTransform
public class MDS extends java.lang.Object implements VisualizationTransform
Multidimensional scaling is an algorithm for finding low dimensional embeddings of arbitrary distance matrices. MDS will attempt to find an embedding that maintains the same pair-wise distances between all items in the distance matrix. MDS is a non-convex problem, so different runs can produce different results.
MDS can be used on arbitrary dissimilarity matrices by calling#transform(jsat.linear.Matrix, java.util.concurrent.ExecutorService).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description MDS()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description DistanceMetricgetEmbeddingMetric()intgetTargetDimension()doublegetTolerance()voidsetEmbeddingMetric(DistanceMetric embedMetric)Sets the distance metric to use when creating the initial dissimilarity matrix of a new dataset.booleansetTargetDimension(int target)Sets the target dimension to embed new dataset to.voidsetTolerance(double tolerance)Sets the tolerance parameter for determining convergence.<Type extends DataSet>
Typetransform(DataSet<Type> d, boolean parallel)Transforms the given data set, returning a dataset of the same type.SimpleDataSettransform(Matrix delta)SimpleDataSettransform(Matrix delta, boolean parallel)-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.datatransform.visualization.VisualizationTransform
transform
-
-
-
-
Method Detail
-
setTolerance
public void setTolerance(double tolerance)
Sets the tolerance parameter for determining convergence.- Parameters:
tolerance- the tolerance for declaring convergence
-
getTolerance
public double getTolerance()
- Returns:
- the tolerance parameter
-
setEmbeddingMetric
public void setEmbeddingMetric(DistanceMetric embedMetric)
Sets the distance metric to use when creating the initial dissimilarity matrix of a new dataset. By default theEuclideandistance is used, but any distance may be substituted.The chosen distance need not be a valid metric, its only requirement is symmetry.- Parameters:
embedMetric- the distance metric to use when creating the dissimilarity matrix.
-
getEmbeddingMetric
public DistanceMetric getEmbeddingMetric()
- Returns:
- the distance metric used when creating a dissimilarity matrix
-
transform
public <Type extends DataSet> Type transform(DataSet<Type> d, boolean parallel)
Description copied from interface:VisualizationTransformTransforms the given data set, returning a dataset of the same type.- Specified by:
transformin interfaceVisualizationTransform- Type Parameters:
Type- the dataset type- Parameters:
d- the data set to transformparallel-trueif transform should be done in parallel, orfalseif it should use a single thread.- Returns:
- the lower dimension dataset for visualization.
-
transform
public SimpleDataSet transform(Matrix delta)
-
transform
public SimpleDataSet transform(Matrix delta, boolean parallel)
-
getTargetDimension
public int getTargetDimension()
- Specified by:
getTargetDimensionin interfaceVisualizationTransform- Returns:
- the number of dimensions that a dataset will be embedded down to
-
setTargetDimension
public boolean setTargetDimension(int target)
Description copied from interface:VisualizationTransformSets the target dimension to embed new dataset to. Many visualization methods may only support a target of 2 or 3 dimensions, or only one of those options. For that reason a boolean value will be returned indicating if the target size was acceptable. If not, no change to the object will occur.- Specified by:
setTargetDimensionin interfaceVisualizationTransform- Parameters:
target- the new target dimension size whenVisualizationTransform.transform(jsat.DataSet)is called.- Returns:
trueif this transform supports that dimension and it was set,falseif the target dimension is unsupported and the previous value will be used instead.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG