[][src]Crate bhtsne

bhtsne

bhtsne contains the implementations of the vanilla version of t-SNE and the Barnes-Hut optimization.

Example

use bhtsne;

// Dummy variables for dummy data.
let n = 8;
let d = 4;
let theta = 0.5;
let perplexity = 1.0;
let max_iter = 2000;
let no_dims = 2;
// Load data and labels from a csv file. Labes are useful for plotting.
let (mut data, labels) = match bhtsne::load_csv("data.csv", true, true, "target", 0) {
    (data, None) => panic!("This is not supposed to happen!"),
    (data, Some(labels)) => (data, labels),
};
let mut y: Vec<f64> = vec![0.0; n * no_dims];
// Run t-SNE.
bhtsne::run(
    &mut data, n, d, &mut y, no_dims, perplexity, theta, false, max_iter, 250, 250,
);
// Writing the embedding to a csv file. Useful for wrappers.
bhtsne::wite_csv("embedding.csv", y, 2);

Functions

load_csv

Loads data from a csv file.

run

Performs t-SNE.

wite_csv

Writes the embedding to a csv file.