pub enum OneHotDrop {
None_,
First,
IfBinary,
}Expand description
Which category (if any) to drop from each feature’s one-hot block at
transform time (OneHotEncoder(drop=...)).
Mirrors scikit-learn’s OneHotEncoder(drop=...) parameter, whose
_parameter_constraints accepts {'first', 'if_binary'}, an array-like, or
None (sklearn/preprocessing/_encoders.py:730, default None). Dropping a
category removes one output column per feature, which is useful to break the
collinearity an unregularized linear model would otherwise see
(_encoders.py:498-516).
ferrolearn ships the None/'first'/'if_binary' modes (REQ-5). The
array-of-explicit-categories form (drop[i] = the category to drop in
feature i, _encoders.py:515-516) is NOT-STARTED.
The variant is named None_ (not None) to avoid colliding with
Option::None.
Variants§
None_
Retain all categories — no column is dropped (scikit-learn’s default
drop=None, _encoders.py:509,:812-813: drop_idx_ = None). The
default here too.
First
Drop the first category of every feature (scikit-learn’s
drop='first', _encoders.py:510-511,:815-816: drop_idx_[j] = 0 for
every feature). A feature with only one category is dropped entirely (its
block width becomes 0).
IfBinary
Drop the first category of every feature that has exactly two
categories, leaving 1-category and 3+-category features intact
(scikit-learn’s drop='if_binary', _encoders.py:512-514,:817-831:
drop_idx_[j] = 0 iff len(categories_[j]) == 2, else None).
Trait Implementations§
Source§impl Clone for OneHotDrop
impl Clone for OneHotDrop
Source§fn clone(&self) -> OneHotDrop
fn clone(&self) -> OneHotDrop
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for OneHotDrop
Source§impl Debug for OneHotDrop
impl Debug for OneHotDrop
Source§impl Default for OneHotDrop
impl Default for OneHotDrop
Source§fn default() -> OneHotDrop
fn default() -> OneHotDrop
impl Eq for OneHotDrop
Source§impl PartialEq for OneHotDrop
impl PartialEq for OneHotDrop
Source§fn eq(&self, other: &OneHotDrop) -> bool
fn eq(&self, other: &OneHotDrop) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for OneHotDrop
Auto Trait Implementations§
impl Freeze for OneHotDrop
impl RefUnwindSafe for OneHotDrop
impl Send for OneHotDrop
impl Sync for OneHotDrop
impl Unpin for OneHotDrop
impl UnsafeUnpin for OneHotDrop
impl UnwindSafe for OneHotDrop
Blanket Implementations§
impl<T> Boilerplate for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.