Class UMAP

java.lang.Object
smile.manifold.UMAP

public class UMAP extends Object
Uniform Manifold Approximation and Projection. UMAP is a dimension reduction technique that can be used for visualization similarly to t-SNE, but also for general non-linear dimension reduction. The algorithm is founded on three assumptions about the data:
  • The data is uniformly distributed on a Riemannian manifold;
  • The Riemannian metric is locally constant (or can be approximated as such);
  • The manifold is locally connected.
From these assumptions it is possible to model the manifold with a fuzzy topological structure. The embedding is found by searching for a low dimensional projection of the data that has the closest possible equivalent fuzzy topological structure.

References

  1. McInnes, L, Healy, J, UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction, ArXiv e-prints 1802.03426, 2018
  2. How UMAP Works
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[][]
    of(double[][] data, int k)
    Runs the UMAP algorithm with Euclidean distance.
    static double[][]
    of(double[][] data, int k, int d, int epochs, double learningRate, double minDist, double spread, int negativeSamples, double repulsionStrength, double localConnectivity)
    Runs the UMAP algorithm with Euclidean distance.
    static <T> double[][]
    of(T[] data, NearestNeighborGraph nng, int d, int epochs, double learningRate, double minDist, double spread, int negativeSamples, double repulsionStrength, double localConnectivity)
    Runs the UMAP algorithm.
    static <T> double[][]
    of(T[] data, Metric<T> distance, int k)
    Runs the UMAP algorithm.
    static <T> double[][]
    of(T[] data, Metric<T> distance, int k, int d, int epochs, double learningRate, double minDist, double spread, int negativeSamples, double repulsionStrength, double localConnectivity)
    Runs the UMAP algorithm.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UMAP

      public UMAP()
  • Method Details

    • of

      public static double[][] of(double[][] data, int k)
      Runs the UMAP algorithm with Euclidean distance.
      Parameters:
      data - The input data.
      k - k-nearest neighbors. Larger values result in more global views of the manifold, while smaller values result in more local data being preserved. Generally in the range 2 to 100.
      Returns:
      The embedding coordinates.
    • of

      public static double[][] of(double[][] data, int k, int d, int epochs, double learningRate, double minDist, double spread, int negativeSamples, double repulsionStrength, double localConnectivity)
      Runs the UMAP algorithm with Euclidean distance.
      Parameters:
      data - The input data.
      k - k-nearest neighbors. Larger values result in more global views of the manifold, while smaller values result in more local data being preserved. Generally in the range 2 to 100.
      d - The target embedding dimensions. defaults to 2 to provide easy visualization, but can reasonably be set to any integer value in the range 2 to 100.
      epochs - The number of iterations to optimize the low-dimensional representation. Larger values result in more accurate embedding. Muse be at least 10. Choose wise value based on the size of the input data, e.g, 200 for large data (1000+ samples), 500 for small.
      learningRate - The initial learning rate for the embedding optimization, default 1.
      minDist - The desired separation between close points in the embedding space. Smaller values will result in a more clustered/clumped embedding where nearby points on the manifold are drawn closer together, while larger values will result on a more even disperse of points. The value should be set no-greater than and relative to the spread value, which determines the scale at which embedded points will be spread out. default 0.1.
      spread - The effective scale of embedded points. In combination with minDist, this determines how clustered/clumped the embedded points are. default 1.0.
      negativeSamples - 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, default 5.
      repulsionStrength - Weighting applied to negative samples in low dimensional embedding optimization. Values higher than one will result in greater weight being given to negative samples, default 1.0.
      Returns:
      The embedding coordinates.
    • of

      public static <T> double[][] of(T[] data, Metric<T> distance, int k)
      Runs the UMAP algorithm.
      Type Parameters:
      T - The data type of points.
      Parameters:
      data - The input data.
      distance - The distance function.
      k - k-nearest neighbor. Larger values result in more global views of the manifold, while smaller values result in more local data being preserved. Generally in the range 2 to 100.
      Returns:
      The embedding coordinates.
    • of

      public static <T> double[][] of(T[] data, Metric<T> distance, int k, int d, int epochs, double learningRate, double minDist, double spread, int negativeSamples, double repulsionStrength, double localConnectivity)
      Runs the UMAP algorithm.
      Type Parameters:
      T - The data type of points.
      Parameters:
      data - The input data.
      distance - The distance function.
      k - k-nearest neighbors. Larger values result in more global views of the manifold, while smaller values result in more local data being preserved. Generally in the range 2 to 100.
      d - The target embedding dimensions. defaults to 2 to provide easy visualization, but can reasonably be set to any integer value in the range 2 to 100.
      epochs - The number of epochs to optimize the low-dimensional representation. Larger values result in more accurate embedding. Muse be at least 10. Choose wise value based on the size of the input data, e.g, 200 for large data (10000+ samples), 500 for small.
      learningRate - The initial learning rate for the embedding optimization, default 1.
      minDist - The desired separation between close points in the embedding space. Smaller values will result in a more clustered/clumped embedding where nearby points on the manifold are drawn closer together, while larger values will result on a more even disperse of points. The value should be set no-greater than and relative to the spread value, which determines the scale at which embedded points will be spread out. default 0.1.
      spread - The effective scale of embedded points. In combination with minDist, this determines how clustered/clumped the embedded points are. default 1.0.
      negativeSamples - 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, default 5.
      repulsionStrength - Weighting applied to negative samples in low dimensional embedding optimization. Values higher than one will result in greater weight being given to negative samples, default 1.0.
      Returns:
      The embedding coordinates.
    • of

      public static <T> double[][] of(T[] data, NearestNeighborGraph nng, int d, int epochs, double learningRate, double minDist, double spread, int negativeSamples, double repulsionStrength, double localConnectivity)
      Runs the UMAP algorithm.
      Type Parameters:
      T - the data type of points.
      Parameters:
      data - The input data.
      nng - The k-nearest neighbor graph.
      d - The target embedding dimensions. defaults to 2 to provide easy visualization, but can reasonably be set to any integer value in the range 2 to 100.
      epochs - The number of iterations to optimize the low-dimensional representation. Larger values result in more accurate embedding. Muse be at least 10. Choose wise value based on the size of the input data, e.g, 200 for large data (1000+ samples), 500 for small.
      learningRate - The initial learning rate for the embedding optimization, default 1.
      minDist - The desired separation between close points in the embedding space. Smaller values will result in a more clustered/clumped embedding where nearby points on the manifold are drawn closer together, while larger values will result on a more even disperse of points. The value should be set no-greater than and relative to the spread value, which determines the scale at which embedded points will be spread out. default 0.1.
      spread - The effective scale of embedded points. In combination with minDist, this determines how clustered/clumped the embedded points are. default 1.0.
      negativeSamples - 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, default 5.
      repulsionStrength - Weighting applied to negative samples in low dimensional embedding optimization. Values higher than one will result in greater weight being given to negative samples, default 1.0.
      localConnectivity - The local connectivity required. That is, the number of nearest neighbors that should be assumed to be connected at a local level. The higher this value the more connected the manifold becomes locally. In practice this should be not more than the local intrinsic dimension of the manifold.
      Returns:
      the embedding coordinates.