pub enum OneHotHandleUnknown {
Error,
Ignore,
}Expand description
How FittedOneHotEncoder treats a category at transform time that was not
seen during fit (an unknown category).
Mirrors scikit-learn’s OneHotEncoder(handle_unknown=...) parameter
(sklearn/preprocessing/_encoders.py:732,750), whose
_parameter_constraints accepts {'error', 'ignore', 'infrequent_if_exist'}
and whose default is 'error'. ferrolearn ships Error (REQ-2) and Ignore
(REQ-4); 'infrequent_if_exist' is NOT-STARTED (REQ-5).
This is a distinct type from
ordinal_encoder::HandleUnknown:
the one-hot encoder’s modes are {error, ignore} while the ordinal encoder’s
are {error, use_encoded_value} (sklearn’s two handle_unknown enums differ
the same way).
Variants§
Error
Raise an error on any unknown category at transform time (scikit-learn’s
default handle_unknown='error', the default here too). The unfitted
encoder’s Transform::transform returns
FerroError::InvalidParameter (“Found unknown categories … during
transform”, _encoders.py:209-214).
Ignore
Encode an unknown category as an all-zero one-hot block for that
feature, leaving every known feature untouched (scikit-learn’s
handle_unknown='ignore', _encoders.py:215-240: the unknown row is
masked out and no column in that feature’s block is set).
Trait Implementations§
Source§impl Clone for OneHotHandleUnknown
impl Clone for OneHotHandleUnknown
Source§fn clone(&self) -> OneHotHandleUnknown
fn clone(&self) -> OneHotHandleUnknown
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 OneHotHandleUnknown
Source§impl Debug for OneHotHandleUnknown
impl Debug for OneHotHandleUnknown
Source§impl Default for OneHotHandleUnknown
impl Default for OneHotHandleUnknown
Source§fn default() -> OneHotHandleUnknown
fn default() -> OneHotHandleUnknown
impl Eq for OneHotHandleUnknown
Source§impl PartialEq for OneHotHandleUnknown
impl PartialEq for OneHotHandleUnknown
Source§fn eq(&self, other: &OneHotHandleUnknown) -> bool
fn eq(&self, other: &OneHotHandleUnknown) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for OneHotHandleUnknown
Auto Trait Implementations§
impl Freeze for OneHotHandleUnknown
impl RefUnwindSafe for OneHotHandleUnknown
impl Send for OneHotHandleUnknown
impl Sync for OneHotHandleUnknown
impl Unpin for OneHotHandleUnknown
impl UnsafeUnpin for OneHotHandleUnknown
impl UnwindSafe for OneHotHandleUnknown
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.