Struct linfa_preprocessing::norm_scaling::NormScaler
source · pub struct NormScaler { /* private fields */ }
Expand description
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§
Trait Implementations§
source§impl Clone for NormScaler
impl Clone for NormScaler
source§fn clone(&self) -> NormScaler
fn clone(&self) -> NormScaler
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for NormScaler
impl Debug for NormScaler
source§impl PartialEq for NormScaler
impl PartialEq for NormScaler
source§fn eq(&self, other: &NormScaler) -> bool
fn eq(&self, other: &NormScaler) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<F: Float> Transformer<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for NormScaler
impl<F: Float> Transformer<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for NormScaler
source§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
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
source§fn transform(
&self,
x: DatasetBase<ArrayBase<D, Ix2>, T>
) -> DatasetBase<Array2<F>, T>
fn transform( &self, x: DatasetBase<ArrayBase<D, Ix2>, T> ) -> DatasetBase<Array2<F>, T>
Substitutes the records of the dataset with their scaled versions with unit norm.
impl Eq for NormScaler
impl StructuralEq for NormScaler
impl StructuralPartialEq for NormScaler
Auto Trait Implementations§
impl RefUnwindSafe for NormScaler
impl Send for NormScaler
impl Sync for NormScaler
impl Unpin for NormScaler
impl UnwindSafe for NormScaler
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.