#[non_exhaustive]pub struct StandardScaler { /* private fields */ }Expand description
Standardize features by removing the mean and scaling to unit variance.
Each feature is transformed as: x' = (x - mean) / std.
Features with zero variance are left unchanged.
Implementations§
Source§impl StandardScaler
impl StandardScaler
Sourcepub fn fit_sparse(&mut self, features: &CscMatrix) -> Result<()>
pub fn fit_sparse(&mut self, features: &CscMatrix) -> Result<()>
Fit on sparse features.
Computes mean and std from sparse columns, correctly accounting for
zero entries: mean = sum_nonzero / n_total.
Sourcepub fn transform_sparse(&self, features: &CscMatrix) -> Result<CscMatrix>
pub fn transform_sparse(&self, features: &CscMatrix) -> Result<CscMatrix>
Transform sparse features, returning a new CscMatrix.
Only scales by std (no centering) to preserve sparsity.
Centering would make all zeros become -mean, destroying sparsity.
Trait Implementations§
Source§impl Clone for StandardScaler
impl Clone for StandardScaler
Source§fn clone(&self) -> StandardScaler
fn clone(&self) -> StandardScaler
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 StandardScaler
impl Debug for StandardScaler
Source§impl Default for StandardScaler
impl Default for StandardScaler
Auto Trait Implementations§
impl Freeze for StandardScaler
impl RefUnwindSafe for StandardScaler
impl Send for StandardScaler
impl Sync for StandardScaler
impl Unpin for StandardScaler
impl UnsafeUnpin for StandardScaler
impl UnwindSafe for StandardScaler
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more