pub struct Standardizer { /* private fields */ }Expand description
The per-column mean and deviation Dataset::standardize measured.
Save it with the model: a network trained on standardized columns predicts
nonsense from a raw row, and the statistics are the only way to put a later
row on the same scale. It is serde-serializable for that reason.
Implementations§
Source§impl Standardizer
impl Standardizer
Sourcepub fn apply(&self, dataset: &mut Dataset)
pub fn apply(&self, dataset: &mut Dataset)
Applies the statistics to every input row of dataset.
Sourcepub fn apply_row(&self, row: &mut [f32])
pub fn apply_row(&self, row: &mut [f32])
Applies them to one row, which is what a prediction needs.
let mut row = vec![2.0];
statistics.apply_row(&mut row);
// model.predict(&row)?;pub fn mean(&self) -> &[f32]
pub fn deviation(&self) -> &[f32]
Trait Implementations§
Source§impl Clone for Standardizer
impl Clone for Standardizer
Source§impl Debug for Standardizer
impl Debug for Standardizer
Source§impl<'de> Deserialize<'de> for Standardizer
impl<'de> Deserialize<'de> for Standardizer
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Standardizer
impl PartialEq for Standardizer
Source§impl Serialize for Standardizer
impl Serialize for Standardizer
impl StructuralPartialEq for Standardizer
Auto Trait Implementations§
impl Forget for Standardizer
impl Freeze for Standardizer
impl Move for Standardizer
impl RefUnwindSafe for Standardizer
impl Send for Standardizer
impl Sync for Standardizer
impl Unpin for Standardizer
impl UnsafeUnpin for Standardizer
impl UnwindSafe for Standardizer
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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