pub struct DiffusionMap<F> { /* private fields */ }
Expand description

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

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

Return the eigenvalue of the diffusion operator

Return the embedding

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Project a kernel matrix to its embedding

Parameter
  • kernel: Kernel matrix
Returns

Embedding for each observation in the kernel matrix

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.