pub struct Scaler {
pub center: Array1<f64>,
pub scale: Array1<f64>,
}Expand description
Fitting a scaler produces these per-column statistics. Reuse them to replay the same transform on new data.
Fit a scaler on the training rows only. Then apply it unchanged to the test
rows. Fitting it on everything leaks information about the test set into
training. That is why standardize and min_max_scale return this struct.
Keep it. Pass it to apply_scaler for every later batch.
The two field names describe the general shape of the transform,
(value - center) / scale:
standardizesetscenterto the column mean andscaleto its standard deviation.min_max_scalesetscenterto the column minimum andscaleto its range.
Fields§
§center: Array1<f64>Per-column value that apply_scaler subtracts before scaling (mean, or minimum).
scale: Array1<f64>Per-column divisor (standard deviation, or range). Never 0: a constant
column gets a scale of 1, so it maps to all-zeros instead of NaN.
Trait Implementations§
impl StructuralPartialEq for Scaler
Auto Trait Implementations§
impl Freeze for Scaler
impl RefUnwindSafe for Scaler
impl Send for Scaler
impl Sync for Scaler
impl Unpin for Scaler
impl UnsafeUnpin for Scaler
impl UnwindSafe for Scaler
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