Struct linfa_preprocessing::linear_scaling::LinearScaler [−][src]
pub struct LinearScaler<F: Float> { /* fields omitted */ }
Linear Scaler: learns scaling parameters, according to the specified method, from a dataset, producing a fitted linear scaler that can be used to scale different datasets using the same parameters.
Example
use linfa::traits::{Fit, Transformer}; use linfa_preprocessing::linear_scaling::LinearScaler; // Load dataset let dataset = linfa_datasets::diabetes(); // Learn scaling parameters let scaler = LinearScaler::standard().fit(&dataset).unwrap(); // scale dataset according to parameters let dataset = scaler.transform(dataset);
Implementations
impl<F: Float> LinearScaler<F>[src]
impl<F: Float> LinearScaler<F>[src]pub fn new(method: ScalingMethod<F>) -> Self[src]
Initializes the scaler with the specified method.
pub fn method(self, method: ScalingMethod<F>) -> Self[src]
Setter for the scaler method
pub fn standard() -> Self[src]
Initializes a Standard scaler
pub fn standard_no_mean() -> Self[src]
Initializes a Standard scaler that does not subract the mean to the features
pub fn standard_no_std() -> Self[src]
Initializes a Stadard scaler that does not scale the features by the inverse of the standard deviation
pub fn min_max() -> Self[src]
Initializes a MinMax scaler with range [0,1]
pub fn min_max_range(min: F, max: F) -> Self[src]
Initializes a MinMax scaler with the specified minimum and maximum values for the range.
If min is bigger than max then fitting will return an error on any input.
pub fn max_abs() -> Self[src]
Initializes a MaxAbs scaler
Trait Implementations
impl<F: Float, D: Data<Elem = F>, T: AsTargets> Fit<ArrayBase<D, Dim<[usize; 2]>>, T, Error> for LinearScaler<F>[src]
impl<F: Float, D: Data<Elem = F>, T: AsTargets> Fit<ArrayBase<D, Dim<[usize; 2]>>, T, Error> for LinearScaler<F>[src]type Object = FittedLinearScaler<F>
fn fit(&self, x: &DatasetBase<ArrayBase<D, Ix2>, T>) -> Result<Self::Object>[src]
Fits the input dataset accordng to the scaler method. Will return an error if the dataset does not contain any samples or (in the case of MinMax scaling) if the specified range is not valid.
Auto Trait Implementations
impl<F> RefUnwindSafe for LinearScaler<F> where
F: RefUnwindSafe,
impl<F> RefUnwindSafe for LinearScaler<F> where
F: RefUnwindSafe, impl<F> Send for LinearScaler<F>
impl<F> Send for LinearScaler<F>impl<F> Sync for LinearScaler<F>
impl<F> Sync for LinearScaler<F>impl<F> Unpin for LinearScaler<F> where
F: Unpin,
impl<F> Unpin for LinearScaler<F> where
F: Unpin, impl<F> UnwindSafe for LinearScaler<F> where
F: UnwindSafe,
impl<F> UnwindSafe for LinearScaler<F> where
F: UnwindSafe,