O
- Object type@Title(value="t-SNE") @Reference(authors="L. J. P. van der Maaten, G. E. Hinton", title="Visualizing High-Dimensional Data Using t-SNE", booktitle="Journal of Machine Learning Research 9", url="http://www.jmlr.org/papers/v9/vandermaaten08a.html", bibkey="journals/jmlr/MaatenH08") @Alias(value={"t-SNE","tSNE"}) public class TSNE<O> extends AbstractProjectionAlgorithm<Relation<DoubleVector>>
Reference:
L. J. P. van der Maaten, G. E. Hinton
Visualizing High-Dimensional Data Using t-SNE
Journal of Machine Learning Research 9
Modifier and Type | Class and Description |
---|---|
static class |
TSNE.Parameterizer<O>
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
protected AffinityMatrixBuilder<? super O> |
affinity
Affinity matrix builder.
|
protected int |
dim
Desired projection dimensionality
|
protected static double |
EARLY_EXAGGERATION
Early exaggeration factor.
|
protected static int |
EARLY_EXAGGERATION_ITERATIONS
Number of iterations to apply early exaggeration.
|
protected double |
finalMomentum
Final momentum.
|
protected static double |
INITIAL_SOLUTION_SCALE
Scale of the initial solution.
|
protected double |
initialMomentum
Final momentum.
|
protected int |
iterations
Number of iterations.
|
protected double |
learningRate
Initial learning rate.
|
private static Logging |
LOG
Class logger.
|
protected static double |
MIN_GAIN
Minimum gain in learning rate.
|
protected static double |
MIN_QIJ
Minimum value for qij entries (even when duplicate)
|
protected int |
momentumSwitch
Iteration when to switch momentum.
|
protected long |
projectedDistances
Number of distance computations performed in projected space.
|
protected RandomFactory |
random
Random generator
|
KEEP_ID
ALGORITHM_ID
Constructor and Description |
---|
TSNE(AffinityMatrixBuilder<? super O> affinity,
int dim,
double finalMomentum,
double learningRate,
int iterations,
RandomFactory random,
boolean keep)
Constructor.
|
TSNE(AffinityMatrixBuilder<? super O> affinity,
int dim,
RandomFactory random)
Constructor with default values.
|
Modifier and Type | Method and Description |
---|---|
protected void |
computeGradient(AffinityMatrix pij,
double[][] qij,
double qij_isum,
double[][] sol,
double[] meta)
Compute the gradients.
|
protected double |
computeQij(double[][] qij,
double[][] solution)
Compute the qij of the solution, and the sum.
|
TypeInformation[] |
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.
|
protected Logging |
getLogger()
Get the (STATIC) logger for this class.
|
protected void |
optimizetSNE(AffinityMatrix pij,
double[][] sol)
Perform the actual tSNE optimization.
|
protected static double[][] |
randomInitialSolution(int size,
int dim,
java.util.Random random)
Generate a random initial solution.
|
Relation<DoubleVector> |
run(Relation<O> relation) |
protected double |
sqDist(double[] v1,
double[] v2)
Squared distance, in projection space.
|
protected void |
updateSolution(double[][] sol,
double[] meta,
int it)
Update the current solution on iteration.
|
removePreviousRelation
run
private static final Logging LOG
protected static final double MIN_QIJ
protected static final double EARLY_EXAGGERATION
Barnes-Hut tSNE implementation used 12.
protected static final int EARLY_EXAGGERATION_ITERATIONS
protected static final double INITIAL_SOLUTION_SCALE
protected static final double MIN_GAIN
protected AffinityMatrixBuilder<? super O> affinity
protected long projectedDistances
protected int dim
protected double learningRate
protected double initialMomentum
protected double finalMomentum
protected int momentumSwitch
protected int iterations
protected RandomFactory random
public TSNE(AffinityMatrixBuilder<? super O> affinity, int dim, RandomFactory random)
affinity
- Affinity matrix builderdim
- Output dimensionalityrandom
- Random generatorpublic TSNE(AffinityMatrixBuilder<? super O> affinity, int dim, double finalMomentum, double learningRate, int iterations, RandomFactory random, boolean keep)
affinity
- Affinity matrix builderdim
- Output dimensionalityfinalMomentum
- Final momentumlearningRate
- Learning rateiterations
- Number of iterationsrandom
- Random generatorkeep
- Keep the original data (or remove it)public Relation<DoubleVector> run(Relation<O> relation)
protected static double[][] randomInitialSolution(int size, int dim, java.util.Random random)
size
- Data set sizedim
- Output dimensionalityrandom
- Random generatorprotected void optimizetSNE(AffinityMatrix pij, double[][] sol)
pij
- Initial affinity matrixsol
- Solution output array (preinitialized)protected double computeQij(double[][] qij, double[][] solution)
qij
- Qij matrix (output)solution
- Solution matrix (input)protected double sqDist(double[] v1, double[] v2)
v1
- First vectorv2
- Second vectorprotected void computeGradient(AffinityMatrix pij, double[][] qij, double qij_isum, double[][] sol, double[] meta)
pij
- Desired affinity matrixqij
- Projected affinity matrixqij_isum
- Normalization factorsol
- Current solution coordinatesmeta
- Point metadataprotected void updateSolution(double[][] sol, double[] meta, int it)
sol
- Solution matrixmeta
- Metadata array (gradient, momentum, learning rate)it
- Iteration number, to choose momentum factor.public TypeInformation[] getInputTypeRestriction()
AbstractAlgorithm
getInputTypeRestriction
in interface Algorithm
getInputTypeRestriction
in class AbstractAlgorithm<Relation<DoubleVector>>
protected Logging getLogger()
AbstractAlgorithm
getLogger
in class AbstractAlgorithm<Relation<DoubleVector>>
Copyright © 2019 ELKI Development Team. License information.