Crate linfa_pls[][src]

Partial Least Squares

linfa-pls provides an implementation of methods in the PLS (Partial Least Squares) family. The PLS method is a statistical method that finds a linear relationship between input variables and output variables by projecting them onto a new subspace formed by newly chosen variables (aka latent variables), which are linear combinations of the input variables. The subspace is choosen to maximize the covariance between responses and independant variables.

This approach is particularly useful when the original data are characterized by a large number of highly collinear variables measured on a small number of samples.

The implementation is a port of the scikit-learn 0.24 cross-decomposition module.

References

Example

use linfa::prelude::*;
use linfa_pls::{errors::Result, PlsRegression};
use ndarray::array;

// Load linnerud datase 20 samples, 3 input features, 3 output features
let ds = linnerud();

// Fit PLS2 method using 2 principal components (latent variables)
let pls = PlsRegression::params(2).fit(&ds)?;

// We can either apply the dimension reduction to a dataset
let reduced_ds = pls.transform(ds);

// ... or predict outputs given a new input sample.
let exercices = array![[14., 146., 61.], [6., 80., 60.]];
let physio_measures = pls.predict(exercices);

Structs

PlsCanonical
PlsCanonicalParams
PlsCca
PlsCcaParams
PlsRegression
PlsRegressionParams
PlsSvd
PlsSvdParams

Enums

PlsError

Traits

Float

Add Scalar and Lapack trait bounds to the common Float trait

Type Definitions

Result