UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction
Umap
00 Remarks
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| .ctor | 1 | |
| InitializeFit | 1 | Initializes fit by computing KNN and a fuzzy simplicial set, as well as initializing the projected embeddings. |
| GetEmbedding | 1 | get projection result |
| GetNEpochs | 1 | Gets the number of epochs for optimizing the projection - NOTE: This heuristic differs from the python version |
| GetEmbeddingSpan | 1 | Get the underlying embedding vector as a Span view for the SGD optimization. |
| FuzzySimplicialSet | 1 | Given a set of data X, a neighborhood size, and a measure of distance compute the fuzzy simplicial set(here represented as a fuzzy graph in the form of a sparse matrix) associate… |
| InitializeSimplicialSetEmbedding | 1 | Initialize a fuzzy simplicial set embedding, using a specified initialisation method and then minimizing the fuzzy set cross entropy between the 1-skeletons of the high and low d… |
| FindABParams | 1 | Fit a, b params for the differentiable curve used in lower dimensional fuzzy simplicial complex construction. |
| Step | 1 | Manually step through the optimization process one epoch at a time |
| OptimizeLayoutStep | 1 | Improve an embedding using stochastic gradient descent to minimize the fuzzy set cross entropy between the 1-skeletons of the high dimensional and low dimensional fuzzy simplicia… |
| RunIterate | 1 | run the SGD iteration of the i th edge of the epoch n |
03 Fields
| Name | Overloads | Summary |
|---|---|---|
| _negativeSampleRate | 1 | The number of negative samples to select per positive sample in the optimization process. |
| _gradientClipValue | 1 | the gradient clipping value of the SGD optimization step |
| _initialEmbeddingRange | 1 | the value range [-a, a] of the uniformly distributed random initialization of the embedding |
| _moveOther | 1 | move the other vertex of the edge while doing the SGD optimization? |
| _epochsSchedule | 1 | the number-of-epochs heuristic of the SGD optimization |
| _parallelism | 1 | the parallelism configuration of the whole UMAP pipeline |
| _optimizationState | 1 | graph data: + head source index + tail target index + value edge weight |
| _kdTreeKNNEngine | 1 | run knn search via kd-tree as mectric engine? |
| _graph | 1 | Internal graph connectivity representation |
| _knn | 1 | KNN state (can be precomputed and supplied via initializeFit) |
| _embedding | 1 | Projected embedding |
04 Members
DistanceCalculation, IProvideRandomValues, Int32, Int32, Double, Int32, Double, Nullable(Of Int32), Nullable(Of Double), Boolean, Double, Double, Double, Double, Double, SetProgressEventHandler, Int32, EpochSchedule, Double, Double, Boolean, Int32, Int32, Int32, Double, Double, Boolean, Int32, ParallelConfig)| Name | Type | Description |
|---|---|---|
distance | DistanceCalculation | - |
random | IProvideRandomValues | - |
dimensions | Int32 | - |
numberOfNeighbors | Int32 | - |
localConnectivity | Double | - |
KnnIter | Int32 | - |
bandwidth | Double | - |
customNumberOfEpochs | Nullable(Of Int32) | a fixed number of the SGD epochs, the epochsSchedule heuristic is used when this parameter value is not set. |
customMapCutoff | Nullable(Of Double) | cutoff value in range |
progressReporter | Boolean | - |
negativeSampleRate | Double | The number of negative samples to select per positive sample in the optimization process (default 5). |
epochsSchedule | Double | the number-of-epochs heuristic that is used by the SGD optimization, the default schedule is: |
gradientClipValue | Double | the gradient clipping value of the SGD optimization step (default 4.0) |
initialEmbeddingRange | Double | the value range [-a, a] of the uniformly distributed random initialization of the embedding (default 10). |
moveOther | Double | move the other vertex of the edge while doing the SGD optimization? (default TRUE) |
nTrees | SetProgressEventHandler | the number of the random projection trees of the rp-forest, the adaptive formula |
leafSize | Int32 | the max size of the leaf node of the random projection tree, the adaptive formula |
maxCandidates | EpochSchedule | the max number of the candidate neighbours of each vertex that is used by the nearest neighbour descent (default 50). |
nnDescentDelta | Double | the early stop threshold of the nearest neighbour descent (default 0.001). |
nnDescentRho | Double | the sample rate of the nearest neighbour descent, a lower value means a faster but more approximate neighbour graph (default 0.5). |
rpTreeInit | Boolean | init the neighbour graph via the random projection forest? (default TRUE) |
nnDescentIters | Int32 | the number of the iterations of the nearest neighbour descent, the adaptive formula |
parallelism | Int32 | the parallelism configuration of the whole UMAP pipeline, the ParallelConfig.Sequential is used when this parameter value is not set. |
Double()())Initializes fit by computing KNN and a fuzzy simplicial set, as well as initializing the projected embeddings. Sets the optimization state ahead of optimization steps.
Returns the number of epochs to be used for the SGD optimization.
get projection result
Gets the number of epochs for optimizing the projection - NOTE: This heuristic differs from the python version
the threshold/epoch value pairs are configurable now via the EpochSchedule object, the default schedule is completely the same as the original hardcoded heuristic.
Get the underlying embedding vector as a Span view for the SGD optimization.
a span view which is bound to the shared embedding vector, the write operation of the span view is directly applied to the embedding vector.
Double()(), Double)Given a set of data X, a neighborhood size, and a measure of distance compute the fuzzy simplicial set(here represented as a fuzzy graph in the form of a sparse matrix) associated to the data. This is done by locally approximating geodesic distance at each point, creating a fuzzy simplicial set for each such point, and then combining all the local fuzzy simplicial sets into a global one via a fuzzy union.
Initialize a fuzzy simplicial set embedding, using a specified initialisation method and then minimizing the fuzzy set cross entropy between the 1-skeletons of the high and low dimensional fuzzy simplicial sets.
Double, Double)Fit a, b params for the differentiable curve used in lower dimensional fuzzy simplicial complex construction. We want the smooth curve (from a pre-defined family with simple gradient) that best matches an offset exponential decay.
the Levenberg-Marquardt algorithm that is required by the curve fitting is implemented inside the ABParams module, so that any combination of the spread/minDist parameters is supported now (previously an ArgumentException will be thrown for any non-default configuration).
the result of the default configuration (spread = 1, minDist = 0.1) is still the original hardcoded constant, so that the default behaviour is not changed at all.
| Name | Type | Description |
|---|---|---|
spread | Double | the effective scale of the embedded points |
minDist | Double | the effective minimum distance between the embedded points |
Manually step through the optimization process one epoch at a time
Int32)Improve an embedding using stochastic gradient descent to minimize the fuzzy set cross entropy between the 1-skeletons of the high dimensional and low dimensional fuzzy simplicial sets.
In practice this is done by sampling edges based on their membership strength(with the (1-p) terms coming from negative sampling similar to word2vec).
Int32, Int32, Double, Span(Of Double))run the SGD iteration of the i th edge of the epoch n
| Name | Type | Description |
|---|---|---|
i | Int32 | the index of the edge |
n | Int32 | the current epoch |
clipValue | Double | the gradient clipping value |
embeddingSpan | Span(Of Double) | a span view which is bound to the shared embedding vector, each worker thread of the parallel SGD creates its own view via Umap.GetEmbeddingSpan(). |
The number of negative samples to select per positive sample in the optimization process. Increasing this value will result in greater repulsive force being applied, greater optimization cost, but slightly more accuracy.
the gradient clipping value of the SGD optimization step
the value range [-a, a] of the uniformly distributed random initialization of the embedding
move the other vertex of the edge while doing the SGD optimization?
the number-of-epochs heuristic of the SGD optimization
the parallelism configuration of the whole UMAP pipeline
graph data:
- head source index
- tail target index
- value edge weight
run knn search via kd-tree as mectric engine?
Internal graph connectivity representation
KNN state (can be precomputed and supplied via initializeFit)
Projected embedding