Struct tangram_features::one_hot_encoded::OneHotEncodedFeatureGroup [−][src]
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
pub fn compute_array_f32(
&self,
features: ArrayViewMut2<'_, f32>,
column: TableColumnView<'_>,
progress: &impl Fn()
)
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for OneHotEncodedFeatureGroup
impl Send for OneHotEncodedFeatureGroup
impl Sync for OneHotEncodedFeatureGroup
impl Unpin for OneHotEncodedFeatureGroup
impl UnwindSafe for OneHotEncodedFeatureGroup
Blanket Implementations
Mutably borrows from an owned value. Read more