jsat.datatransform.visualization
Class TSNE
- java.lang.Object
-
- jsat.datatransform.visualization.TSNE
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, VisualizationTransform
public class TSNE extends java.lang.Object implements VisualizationTransform
t-distributed Stochastic Neighbor Embedding is an algorithm for creating low dimensional embeddings of datasets, for the purpose of visualization. It attempts to keep points that are near each other in the original space near each other in the low dimensional space as well, with less emphasis on maintaining far-away relationships in the data. This implementation uses the approximated gradients to learn the embedding in O(n log n) time.
If the input dataset has a dimension greater than 50, it is advisable to project the data set down to 50 dimensions usingPCAor some similar technique.
See:
- Maaten, L. Van Der, & Hinton, G. (2008). Visualizing Data using t-SNE. Journal of Machine Learning Research, 9, 2579–2605.
- Van der Maaten, L. (2014). Accelerating t-SNE using Tree-Based Algorithms. Journal of Machine Learning Research, 15, 3221–3245. Retrieved from here
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description TSNE()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublegetAlpha()intgetIterations()doublegetPerplexity()intgetTargetDimension()voidsetAlpha(double alpha)α is the "early exaggeration" constant.voidsetIterations(int T)Sets the desired number of gradient descent iterations to perform.voidsetPerplexity(double perplexity)Sets the target perplexity of the gaussian used over each data point.booleansetTargetDimension(int target)Sets the target dimension to embed new dataset to.<Type extends DataSet>
Typetransform(DataSet<Type> d, boolean parallel)Transforms the given data set, returning a dataset of the same type.-
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
-
setAlpha
public void setAlpha(double alpha)
α is the "early exaggeration" constant. It is a multiple applied to part of the gradient for th first quarter of iterations, and can improve the quality of the solution found. A value in the range of [4, 20] is recommended.- Parameters:
alpha- the exaggeration constant
-
getAlpha
public double getAlpha()
- Returns:
- the "early exaggeration" constant
-
setPerplexity
public void setPerplexity(double perplexity)
Sets the target perplexity of the gaussian used over each data point. The perplexity can be thought of as a quasi desired number of nearest neighbors to be considered, but is adapted based on the distribution of the data. Increasing the perplexity can increase the amount of time it takes to get an embedding. Using a value in the range of [5, 50] is recommended.- Parameters:
perplexity- the quasi number of neighbors to consider for each data point
-
getPerplexity
public double getPerplexity()
- Returns:
- the target perplexity to use for each data point
-
setIterations
public void setIterations(int T)
Sets the desired number of gradient descent iterations to perform.- Parameters:
T- the number of gradient descent iterations
-
getIterations
public int getIterations()
- Returns:
- the number of gradient descent iterations to perform
-
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.
-
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