All Projects → frjnn → bhtsne

frjnn / bhtsne

Licence: MIT license
Parallel Barnes-Hut t-SNE implementation written in Rust.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to bhtsne

moses
Streaming, Memory-Limited, r-truncated SVD Revisited!
Stars: ✭ 19 (-55.81%)
Mutual labels:  dimensionality-reduction
tldr
TLDR is an unsupervised dimensionality reduction method that combines neighborhood embedding learning with the simplicity and effectiveness of recent self-supervised learning losses
Stars: ✭ 95 (+120.93%)
Mutual labels:  dimensionality-reduction
adenine
ADENINE: A Data ExploratioN PipelINE
Stars: ✭ 15 (-65.12%)
Mutual labels:  dimensionality-reduction
enstop
Ensemble topic modelling with pLSA
Stars: ✭ 104 (+141.86%)
Mutual labels:  dimensionality-reduction
50-days-of-Statistics-for-Data-Science
This repository consist of a 50-day program. All the statistics required for the complete understanding of data science will be uploaded in this repository.
Stars: ✭ 19 (-55.81%)
Mutual labels:  dimensionality-reduction
scHPF
Single-cell Hierarchical Poisson Factorization
Stars: ✭ 52 (+20.93%)
Mutual labels:  dimensionality-reduction
uapca
Uncertainty-aware principal component analysis.
Stars: ✭ 16 (-62.79%)
Mutual labels:  dimensionality-reduction
proxyC
R package for large-scale similarity/distance computation
Stars: ✭ 19 (-55.81%)
Mutual labels:  similarity-measures
spykesim
Extended edit similarity measurement for high dimensional discrete-time series signal (e.g., multi-unit spike-train).
Stars: ✭ 18 (-58.14%)
Mutual labels:  similarity-measures
similarity measures
Quantify the difference between two arbitrary curves in space
Stars: ✭ 140 (+225.58%)
Mutual labels:  similarity-measures
edits.cr
Edit distance algorithms inc. Jaro, Damerau-Levenshtein, and Optimal Alignment
Stars: ✭ 16 (-62.79%)
Mutual labels:  similarity-measures
lfda
Local Fisher Discriminant Analysis in R
Stars: ✭ 74 (+72.09%)
Mutual labels:  dimensionality-reduction
walklets
A lightweight implementation of Walklets from "Don't Walk Skip! Online Learning of Multi-scale Network Embeddings" (ASONAM 2017).
Stars: ✭ 94 (+118.6%)
Mutual labels:  dimensionality-reduction
ParametricUMAP paper
Parametric UMAP embeddings for representation and semisupervised learning. From the paper "Parametric UMAP: learning embeddings with deep neural networks for representation and semi-supervised learning" (Sainburg, McInnes, Gentner, 2020).
Stars: ✭ 132 (+206.98%)
Mutual labels:  dimensionality-reduction
timecorr
Estimate dynamic high-order correlations in multivariate timeseries data
Stars: ✭ 30 (-30.23%)
Mutual labels:  dimensionality-reduction
SAFNet
[IROS 2021] Implementation of "Similarity-Aware Fusion Network for 3D Semantic Segmentation"
Stars: ✭ 19 (-55.81%)
Mutual labels:  similarity-measures
ReductionWrappers
R wrappers to connect Python dimensional reduction tools and single cell data objects (Seurat, SingleCellExperiment, etc...)
Stars: ✭ 31 (-27.91%)
Mutual labels:  dimensionality-reduction
Spectre
A computational toolkit in R for the integration, exploration, and analysis of high-dimensional single-cell cytometry and imaging data.
Stars: ✭ 31 (-27.91%)
Mutual labels:  dimensionality-reduction
Dimensionality-reduction-and-classification-on-Hyperspectral-Images-Using-Python
In this repository, You can find the files which implement dimensionality reduction on the hyperspectral image(Indian Pines) with classification.
Stars: ✭ 63 (+46.51%)
Mutual labels:  dimensionality-reduction
pymde
Minimum-distortion embedding with PyTorch
Stars: ✭ 420 (+876.74%)
Mutual labels:  dimensionality-reduction

bhtsne

License: MIT Gethseman codecov

Parallel Barnes-Hut and exact implementations of the t-SNE algorithm written in Rust. The tree-accelerated version of the algorithm is described with fine detail in this paper by Laurens van der Maaten. The exact, original, version of the algorithm is described in this other paper by G. Hinton and Laurens van der Maaten. Additional implementations of the algorithm, including this one, are listed at this page.

Installation

Add this line to your Cargo.toml:

[dependencies]
bhtsne = "0.5.1"

Documentation

The API documentation is available here.

Example

The implementation supports custom data types and custom defined metrics. For instance, general vector data can be handled in the following way.

 use bhtsne;

 const N: usize = 150;         // Number of vectors to embed.
 const D: usize = 4;           // The dimensionality of the
                               // original space.
 const THETA: f32 = 0.5;       // Parameter used by the Barnes-Hut algorithm.
                               // Small values improve accuracy but increase complexity.

 const PERPLEXITY: f32 = 10.0; // Perplexity of the conditional distribution.
 const EPOCHS: usize = 2000;   // Number of fitting iterations.
 const NO_DIMS: u8 = 2;        // Dimensionality of the embedded space.
 
 // Loads the data from a csv file skipping the first row,
 // treating it as headers and skipping the 5th column,
 // treating it as a class label.
 // Do note that you can also switch to f64s for higher precision.
 let data: Vec<f32> = bhtsne::load_csv("iris.csv", true, Some(&[4]), |float| {
         float.parse().unwrap()
 })?;
 let samples: Vec<&[f32]> = data.chunks(D).collect();
 // Executes the Barnes-Hut approximation of the algorithm and writes the embedding to the
 // specified csv file.
 bhtsne::tSNE::new(&samples)
     .embedding_dim(NO_DIMS)
     .perplexity(PERPLEXITY)
     .epochs(EPOCHS)
     .barnes_hut(THETA, |sample_a, sample_b| {
             sample_a
             .iter()
             .zip(sample_b.iter())
             .map(|(a, b)| (a - b).powi(2))
             .sum::<f32>()
             .sqrt()
     })
     .write_csv("iris_embedding.csv")?;

In the example euclidean distance is used, but any other distance metric on data types of choice, such as strings, can be defined and plugged in.

Parallelism

Being built on rayon, the algorithm uses the same number of threads as the number of CPUs available. Do note that on systems with hyperthreading enabled this equals the number of logical cores and not the physical ones. See rayon's FAQs for additional informations.

MNIST embedding

The following embedding has been obtained by preprocessing the MNIST train set using PCA to reduce its dimensionality to 50. It took approximately 3 minutes and 6 seconds on a 2.0GHz quad-core 10th-generation i5 MacBook Pro. mnist

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].