Struct linfa_preprocessing::norm_scaling::NormScaler[][src]

pub struct NormScaler { /* fields omitted */ }

Norm scaler: scales all samples in a dataset to have unit norm, according to the specified norm measure

Example

use linfa::traits::Transformer;
use linfa_preprocessing::norm_scaling::NormScaler;

// Load dataset
let dataset = linfa_datasets::diabetes();
// Initialize scaler
let scaler = NormScaler::l2();
// Scale dataset
let dataset = scaler.transform(dataset);

Implementations

impl NormScaler[src]

pub fn l2() -> Self[src]

Initializes a norm scaler that uses l2 norm

pub fn l1() -> Self[src]

Initializes a norm scaler that uses l1 norm

pub fn max() -> Self[src]

Initializes a norm scaler that uses max norm

Trait Implementations

impl<F: Float> Transformer<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for NormScaler[src]

fn transform(&self, x: Array2<F>) -> Array2<F>[src]

Scales all samples in the array of shape (nsamples, nfeatures) to have unit norm.

impl<F: Float, D: Data<Elem = F>, T: AsTargets> Transformer<DatasetBase<ArrayBase<D, Dim<[usize; 2]>>, T>, DatasetBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, T>> for NormScaler[src]

fn transform(
    &self,
    x: DatasetBase<ArrayBase<D, Ix2>, T>
) -> DatasetBase<Array2<F>, T>
[src]

Substitutes the records of the dataset with their scaled versions with unit norm.

Auto Trait Implementations

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, 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>,