pub struct NormalizedFeatureGroup {
pub source_column_name: String,
pub mean: f32,
pub variance: f32,
}
Expand description
A NormalizedFeatureGroup
transforms a number column to zero mean and unit variance. [Learn more](https://en.wikipedia.org/wiki/Feature_scaling#Standardization_(Z-score_Normalization).
§Example
use tangram_table::prelude::*;
NumberTableColumn::new(
Some("values".to_owned()),
vec![0.0, 5.2, 1.3, 10.0],
);
Mean: 2.16667
Standard Deviation: 2.70617
feature_value = (value - mean) / std
input value | feature value |
---|---|
0.0 | (0.0 - 2.16667) / 2.70617 = -0.80064 |
5.2 | (5.2 - 2.16667) / 2.70617 = 1.12089 |
1.3 | (1.3 - 2.16667) / 2.70617 = -0.32026 |
Fields§
§source_column_name: String
§mean: f32
§variance: f32
Implementations§
Source§impl NormalizedFeatureGroup
impl NormalizedFeatureGroup
pub fn compute_for_column(column: TableColumnView<'_>) -> NormalizedFeatureGroup
Source§impl NormalizedFeatureGroup
impl NormalizedFeatureGroup
pub fn compute_table( &self, column: TableColumnView<'_>, progress: &impl Fn(u64), ) -> TableColumn
pub fn compute_array_f32( &self, features: ArrayViewMut2<'_, f32>, column: TableColumnView<'_>, progress: &impl Fn(), )
pub fn compute_array_value( &self, features: ArrayViewMut2<'_, TableValue<'_>>, column: TableColumnView<'_>, progress: &impl Fn(), )
Trait Implementations§
Source§impl Clone for NormalizedFeatureGroup
impl Clone for NormalizedFeatureGroup
Source§fn clone(&self) -> NormalizedFeatureGroup
fn clone(&self) -> NormalizedFeatureGroup
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 moreAuto Trait Implementations§
impl Freeze for NormalizedFeatureGroup
impl RefUnwindSafe for NormalizedFeatureGroup
impl Send for NormalizedFeatureGroup
impl Sync for NormalizedFeatureGroup
impl Unpin for NormalizedFeatureGroup
impl UnwindSafe for NormalizedFeatureGroup
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