#[non_exhaustive]pub struct OneHotEncoder { /* private fields */ }Expand description
One-hot encoder for integer-encoded categorical features.
Replaces each selected column with n_categories binary columns
(minus any dropped by the DropStrategy). Non-selected columns
pass through untouched.
Implementations§
Source§impl OneHotEncoder
impl OneHotEncoder
Sourcepub fn new(feature_indices: Vec<usize>) -> Self
pub fn new(feature_indices: Vec<usize>) -> Self
Create a new encoder for the given feature column indices.
Sourcepub fn drop(self, strategy: DropStrategy) -> Self
pub fn drop(self, strategy: DropStrategy) -> Self
Set the drop strategy.
Sourcepub fn handle_unknown(self, strategy: UnknownStrategy) -> Self
pub fn handle_unknown(self, strategy: UnknownStrategy) -> Self
Set the unknown-category strategy.
Sourcepub fn categories(&self) -> &[Vec<f64>]
pub fn categories(&self) -> &[Vec<f64>]
Learned categories for each encoded feature.
Sourcepub fn get_feature_names(&self) -> Vec<String>
pub fn get_feature_names(&self) -> Vec<String>
Compute the output feature names that transform would produce.
Trait Implementations§
Source§impl Clone for OneHotEncoder
impl Clone for OneHotEncoder
Source§fn clone(&self) -> OneHotEncoder
fn clone(&self) -> OneHotEncoder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OneHotEncoder
impl Debug for OneHotEncoder
Auto Trait Implementations§
impl Freeze for OneHotEncoder
impl RefUnwindSafe for OneHotEncoder
impl Send for OneHotEncoder
impl Sync for OneHotEncoder
impl Unpin for OneHotEncoder
impl UnsafeUnpin for OneHotEncoder
impl UnwindSafe for OneHotEncoder
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