pub struct OneHotEncodedFeatureGroup {
pub source_column_name: String,
pub variants: Vec<String>,
}
Expand description
A OneHotEncodedFeatureGroup
creates one number feature for each variant in an enum column, plus one number feature for invalid values. For each example, all of the features will have the value 0.0, except the feature corresponding to the column’s value, which will have the value 1.0.
§Example
use std::num::NonZeroUsize;
use tangram_table::prelude::*;
EnumTableColumn::new(
Some("color".to_owned()),
vec!["red".to_owned(), "green".to_owned(), "blue".to_owned()],
vec![None, Some(NonZeroUsize::new(1).unwrap()), Some(NonZeroUsize::new(2).unwrap()), Some(NonZeroUsize::new(3).unwrap())],
);
input value | feature values |
---|---|
“INVALID!” | [0, 0, 0] |
“red” | [1, 0, 0] |
“green” | [0, 1, 0] |
“blue” | [0, 0, 1] |
Fields§
§source_column_name: String
§variants: Vec<String>
Implementations§
Source§impl OneHotEncodedFeatureGroup
impl OneHotEncodedFeatureGroup
pub fn compute_for_column( column: TableColumnView<'_>, ) -> OneHotEncodedFeatureGroup
Source§impl OneHotEncodedFeatureGroup
impl OneHotEncodedFeatureGroup
pub fn compute_array_f32( &self, features: ArrayViewMut2<'_, f32>, column: TableColumnView<'_>, progress: &impl Fn(), )
Trait Implementations§
Source§impl Clone for OneHotEncodedFeatureGroup
impl Clone for OneHotEncodedFeatureGroup
Source§fn clone(&self) -> OneHotEncodedFeatureGroup
fn clone(&self) -> OneHotEncodedFeatureGroup
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 OneHotEncodedFeatureGroup
impl RefUnwindSafe for OneHotEncodedFeatureGroup
impl Send for OneHotEncodedFeatureGroup
impl Sync for OneHotEncodedFeatureGroup
impl Unpin for OneHotEncodedFeatureGroup
impl UnwindSafe for OneHotEncodedFeatureGroup
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