Functions
ML::UMAP Namespace Reference

Functions

void find_ab (const raft::handle_t &handle, UMAPParams *params)
 
std::unique_ptr< raft::sparse::COO< float, int > > get_graph (const raft::handle_t &handle, float *X, float *y, int n, int d, int64_t *knn_indices, float *knn_dists, UMAPParams *params)
 
void refine (const raft::handle_t &handle, float *X, int n, int d, raft::sparse::COO< float, int > *graph, UMAPParams *params, float *embeddings)
 
void init_and_refine (const raft::handle_t &handle, float *X, int n, int d, raft::sparse::COO< float, int > *graph, UMAPParams *params, float *embeddings)
 
void fit (const raft::handle_t &handle, float *X, float *y, int n, int d, int64_t *knn_indices, float *knn_dists, UMAPParams *params, float *embeddings, raft::sparse::COO< float, int > *graph)
 
void fit_sparse (const raft::handle_t &handle, int *indptr, int *indices, float *data, size_t nnz, float *y, int n, int d, int *knn_indices, float *knn_dists, UMAPParams *params, float *embeddings, raft::sparse::COO< float, int > *graph)
 
void transform (const raft::handle_t &handle, float *X, int n, int d, float *orig_X, int orig_n, float *embedding, int embedding_n, UMAPParams *params, float *transformed)
 
void transform_sparse (const raft::handle_t &handle, int *indptr, int *indices, float *data, size_t nnz, int n, int d, int *orig_x_indptr, int *orig_x_indices, float *orig_x_data, size_t orig_nnz, int orig_n, float *embedding, int embedding_n, UMAPParams *params, float *transformed)
 

Function Documentation

◆ find_ab()

void ML::UMAP::find_ab ( const raft::handle_t &  handle,
UMAPParams params 
)

Returns the simplical set to be consumed by the ML::UMAP::refine function.

Parameters
[in]handleraft::handle_t
[out]paramspointer to ML::UMAPParams object of which the a and b parameters will be updated

◆ fit()

void ML::UMAP::fit ( const raft::handle_t &  handle,
float *  X,
float *  y,
int  n,
int  d,
int64_t *  knn_indices,
float *  knn_dists,
UMAPParams params,
float *  embeddings,
raft::sparse::COO< float, int > *  graph 
)

Dense fit

Parameters
[in]handleraft::handle_t
[in]Xpointer to input array
[in]ypointer to labels array
[in]nn_samples of input array
[in]dn_features of input array
[in]knn_indicespointer to knn_indices of input (optional)
[in]knn_distspointer to knn_dists of input (optional)
[in]paramspointer to ML::UMAPParams object
[out]embeddingspointer to embedding produced through projection
[out]graphpointer to fuzzy simplicial set graph

◆ fit_sparse()

void ML::UMAP::fit_sparse ( const raft::handle_t &  handle,
int *  indptr,
int *  indices,
float *  data,
size_t  nnz,
float *  y,
int  n,
int  d,
int *  knn_indices,
float *  knn_dists,
UMAPParams params,
float *  embeddings,
raft::sparse::COO< float, int > *  graph 
)

Sparse fit

Parameters
[in]handleraft::handle_t
[in]indptrpointer to index pointer array of input array
[in]indicespointer to index array of input array
[in]datapointer to data array of input array
[in]nnzpointer to data array of input array
[in]ypointer to labels array
[in]nn_samples of input array
[in]dn_features of input array
[in]knn_indicespointer to knn_indices of input (optional)
[in]knn_distspointer to knn_dists of input (optional)
[in]paramspointer to ML::UMAPParams object
[out]embeddingspointer to embedding produced through projection
[out]graphpointer to fuzzy simplicial set graph

◆ get_graph()

std::unique_ptr<raft::sparse::COO<float, int> > ML::UMAP::get_graph ( const raft::handle_t &  handle,
float *  X,
float *  y,
int  n,
int  d,
int64_t *  knn_indices,
float *  knn_dists,
UMAPParams params 
)

Returns the simplical set to be consumed by the ML::UMAP::refine function.

Parameters
[in]handleraft::handle_t
[in]Xpointer to input array
[in]ypointer to labels array
[in]nn_samples of input array
[in]dn_features of input array
[in]knn_indicespointer to knn_indices (optional)
[in]knn_distspointer to knn_dists (optional)
[in]paramspointer to ML::UMAPParams object
Returns
: simplical set as a unique pointer to a raft::sparse::COO object

◆ init_and_refine()

void ML::UMAP::init_and_refine ( const raft::handle_t &  handle,
float *  X,
int  n,
int  d,
raft::sparse::COO< float, int > *  graph,
UMAPParams params,
float *  embeddings 
)

Initializes embeddings and performs a UMAP fit on them, which enables iterative fitting without callbacks.

Parameters
[in]handleraft::handle_t
[in]Xpointer to input array
[in]nn_samples of input array
[in]dn_features of input array
[in]graphpointer to raft::sparse::COO object computed using ML::UMAP::get_graph
[in]paramspointer to ML::UMAPParams object
[out]embeddingspointer to current embedding with shape n * n_components, stores updated embeddings on executing refine

◆ refine()

void ML::UMAP::refine ( const raft::handle_t &  handle,
float *  X,
int  n,
int  d,
raft::sparse::COO< float, int > *  graph,
UMAPParams params,
float *  embeddings 
)

Performs a UMAP fit on existing embeddings without reinitializing them, which enables iterative fitting without callbacks.

Parameters
[in]handleraft::handle_t
[in]Xpointer to input array
[in]nn_samples of input array
[in]dn_features of input array
[in]graphpointer to raft::sparse::COO object computed using ML::UMAP::get_graph
[in]paramspointer to ML::UMAPParams object
[out]embeddingspointer to current embedding with shape n * n_components, stores updated embeddings on executing refine

◆ transform()

void ML::UMAP::transform ( const raft::handle_t &  handle,
float *  X,
int  n,
int  d,
float *  orig_X,
int  orig_n,
float *  embedding,
int  embedding_n,
UMAPParams params,
float *  transformed 
)

Dense transform

Parameters
[in]handleraft::handle_t
[in]Xpointer to input array to be inferred
[in]nn_samples of input array to be inferred
[in]dn_features of input array to be inferred
[in]orig_Xpointer to original training array
[in]orig_nnumber of rows in original training array
[in]embeddingpointer to embedding created during training
[in]embedding_nnumber of rows in embedding created during training
[in]paramspointer to ML::UMAPParams object
[out]transformedpointer to embedding produced through projection

◆ transform_sparse()

void ML::UMAP::transform_sparse ( const raft::handle_t &  handle,
int *  indptr,
int *  indices,
float *  data,
size_t  nnz,
int  n,
int  d,
int *  orig_x_indptr,
int *  orig_x_indices,
float *  orig_x_data,
size_t  orig_nnz,
int  orig_n,
float *  embedding,
int  embedding_n,
UMAPParams params,
float *  transformed 
)

Sparse transform

Parameters
[in]handleraft::handle_t
[in]indptrpointer to index pointer array of input array to be inferred
[in]indicespointer to index array of input array to be inferred
[in]datapointer to data array of input array to be inferred
[in]nnznumber of stored values of input array to be inferred
[in]nn_samples of input array
[in]dn_features of input array
[in]orig_x_indptrpointer to index pointer array of original training array
[in]orig_x_indicespointer to index array of original training array
[in]orig_x_datapointer to data array of original training array
[in]orig_nnznumber of stored values of original training array
[in]orig_nnumber of rows in original training array
[in]embeddingpointer to embedding created during training
[in]embedding_nnumber of rows in embedding created during training
[in]paramspointer to ML::UMAPParams object
[out]transformedpointer to embedding produced through projection