pub struct TSneValidParams<F, R> { /* private fields */ }
Expand description

The t-SNE algorithm is a statistical method for visualizing high-dimensional data by giving each datapoint a location in a two or three-dimensional map.

The t-SNE algorithm comprises two main stages. First, t-SNE constructs a probability distribution over pairs of high-dimensional objects in such a way that similar objects are assigned a higher probability while dissimilar points are assigned a lower probability. Second, t-SNE defines a similar probability distribution over the points in the low-dimensional map, and it minimizes the Kullback–Leibler divergence (KL divergence) between the two distributions with respect to the locations of the points in the map.

This crate wraps the bhtsne crate for the linfa project. It implements the exact t-SNE, as well as the Barnes-Hut approximation.

Examples

use linfa::traits::Transformer;
use linfa_tsne::TSneParams;

let ds = linfa_datasets::iris();

let ds = TSneParams::embedding_size(2)
    .perplexity(10.0)
    .approx_threshold(0.6)
    .transform(ds);

A verified hyper-parameter set ready for prediction

Implementations§

source§

impl<F: Float, R> TSneValidParams<F, R>

source

pub fn embedding_size(&self) -> usize

source

pub fn approx_threshold(&self) -> F

source

pub fn perplexity(&self) -> F

source

pub fn max_iter(&self) -> usize

source

pub fn preliminary_iter(&self) -> &Option<usize>

source

pub fn rng(&self) -> &R

Trait Implementations§

source§

impl<F: Clone, R: Clone> Clone for TSneValidParams<F, R>

source§

fn clone(&self) -> TSneValidParams<F, R>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<F: Debug, R: Debug> Debug for TSneValidParams<F, R>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<F: PartialEq, R: PartialEq> PartialEq for TSneValidParams<F, R>

source§

fn eq(&self, other: &TSneValidParams<F, R>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<F: Float, R: Rng + Clone> Transformer<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, Result<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, TSneError>> for TSneValidParams<F, R>

source§

fn transform(&self, data: Array2<F>) -> Result<Array2<F>>

source§

impl<T, F: Float, R: Rng + Clone> Transformer<DatasetBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, T>, Result<DatasetBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, T>, TSneError>> for TSneValidParams<F, R>

source§

fn transform( &self, ds: DatasetBase<Array2<F>, T> ) -> Result<DatasetBase<Array2<F>, T>>

source§

impl<F, R> StructuralPartialEq for TSneValidParams<F, R>

Auto Trait Implementations§

§

impl<F, R> RefUnwindSafe for TSneValidParams<F, R>

§

impl<F, R> Send for TSneValidParams<F, R>
where F: Send, R: Send,

§

impl<F, R> Sync for TSneValidParams<F, R>
where F: Sync, R: Sync,

§

impl<F, R> Unpin for TSneValidParams<F, R>
where F: Unpin, R: Unpin,

§

impl<F, R> UnwindSafe for TSneValidParams<F, R>
where F: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V