Package elki.projection
Class GaussianAffinityMatrixBuilder<O>
- java.lang.Object
-
- elki.projection.GaussianAffinityMatrixBuilder<O>
-
- Type Parameters:
O- Vector type
- All Implemented Interfaces:
AffinityMatrixBuilder<O>
- Direct Known Subclasses:
PerplexityAffinityMatrixBuilder
@Reference(authors="G. Hinton, S. Roweis", title="Stochastic Neighbor Embedding", booktitle="Advances in Neural Information Processing Systems 15", url="http://papers.nips.cc/paper/2276-stochastic-neighbor-embedding", bibkey="DBLP:conf/nips/HintonR02") public class GaussianAffinityMatrixBuilder<O> extends java.lang.Object implements AffinityMatrixBuilder<O>
Compute the affinity matrix for SNE and tSNE using a Gaussian distribution with a constant sigma.Reference:
G. Hinton, S. Roweis
Stochastic Neighbor Embedding
Advances in Neural Information Processing Systems 15- Since:
- 0.7.5
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGaussianAffinityMatrixBuilder.Par<O>Parameterization class.
-
Constructor Summary
Constructors Constructor Description GaussianAffinityMatrixBuilder(Distance<? super O> distance, double sigma)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double[][]buildDistanceMatrix(ArrayDBIDs ids, DistanceQuery<?> dq)Build a distance matrix of squared distances.<T extends O>
AffinityMatrixcomputeAffinityMatrix(Relation<T> relation, double initialScale)Compute the affinity matrix.protected static doublecomputeH(int i, double[] dist_i, double[] pij_i, double mbeta)Compute H (observed perplexity) for row i, and the row pij_i.protected static double[][]computePij(double[][] dist, double sigma, double initialScale)Compute the pij from the distance matrix.TypeInformationgetInputTypeRestriction()Supported input data.
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger.
-
MIN_PIJ
protected static final double MIN_PIJ
Minimum value for pij entries (even when duplicate)- See Also:
- Constant Field Values
-
sigma
protected double sigma
Kernel bandwidth sigma.
-
-
Method Detail
-
computeAffinityMatrix
public <T extends O> AffinityMatrix computeAffinityMatrix(Relation<T> relation, double initialScale)
Description copied from interface:AffinityMatrixBuilderCompute the affinity matrix.- Specified by:
computeAffinityMatrixin interfaceAffinityMatrixBuilder<O>- Type Parameters:
T- Relation type- Parameters:
relation- Data relationinitialScale- initial scale- Returns:
- Affinity matrix
-
buildDistanceMatrix
protected double[][] buildDistanceMatrix(ArrayDBIDs ids, DistanceQuery<?> dq)
Build a distance matrix of squared distances.- Parameters:
ids- DBIDsdq- Distance query- Returns:
- Distance matrix
-
computePij
protected static double[][] computePij(double[][] dist, double sigma, double initialScale)Compute the pij from the distance matrix.- Parameters:
dist- Distance matrix.sigma- Kernel bandwidth sigmainitialScale- Initial scale- Returns:
- Affinity matrix pij
-
computeH
protected static double computeH(int i, double[] dist_i, double[] pij_i, double mbeta)Compute H (observed perplexity) for row i, and the row pij_i.- Parameters:
i- Current point i (entry i will be ignored)dist_i- Distance matrix row (input)pij_i- Row pij[i] (output)mbeta--1. / (2 * sigma * sigma)- Returns:
- Observed perplexity
-
getInputTypeRestriction
public TypeInformation getInputTypeRestriction()
Supported input data.- Specified by:
getInputTypeRestrictionin interfaceAffinityMatrixBuilder<O>- Returns:
- Input data type information.
-
-