Struct linfa_reduction::diffusion_map::DiffusionMap[][src]

pub struct DiffusionMap<F> { /* fields omitted */ }

Embedding of diffusion map technique

After transforming the dataset with diffusion map this structure store the embedding for further use. No straightforward prediction can be made from the embedding and the algorithm falls therefore in the class of transformers.

The diffusion map computes an embedding of the data by applying PCA on the diffusion operator of the data. It transforms the data along the direction of the largest diffusion flow and is therefore a non-linear dimensionality reduction technique. A normalized kernel describes the high dimensional diffusion graph with the (i, j) entry the probability that a diffusion happens from point i to j.

Example

use linfa::traits::Transformer;
use linfa_kernel::{Kernel, KernelType, KernelMethod};
use linfa_reduction::DiffusionMap;

let dataset = linfa_datasets::iris();

// generate sparse gaussian kernel with eps = 2 and 15 neighbors
let kernel = Kernel::params()
    .kind(KernelType::Sparse(15))
    .method(KernelMethod::Gaussian(2.0))
    .transform(dataset.records());

// create embedding from kernel matrix using diffusion maps
let mapped_kernel = DiffusionMap::<f64>::params(2)
    .steps(1)
    .transform(&kernel)
    .unwrap();

// get embedding from the transformed kernel matrix
let embedding = mapped_kernel.embedding();

Implementations

impl<F: Float + Lapack> DiffusionMap<F>[src]

pub fn params(embedding_size: usize) -> DiffusionMapParams[src]

Creates the set of default parameters

Parameters

  • embedding_size: the number of dimensions in the projection

Returns

Parameter set with number of steps = 1

pub fn estimate_clusters(&self) -> usize[src]

Estimate the number of clusters in this embedding (very crude for now)

pub fn eigvals(&self) -> &Array1<F>[src]

Return the eigenvalue of the diffusion operator

pub fn embedding(&self) -> &Array2<F>[src]

Return the embedding

Auto Trait Implementations

impl<F> RefUnwindSafe for DiffusionMap<F> where
    F: RefUnwindSafe

impl<F> Send for DiffusionMap<F> where
    F: Send

impl<F> Sync for DiffusionMap<F> where
    F: Sync

impl<F> Unpin for DiffusionMap<F>

impl<F> UnwindSafe for DiffusionMap<F> where
    F: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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