pub struct TargetEncoder {
pub smoothing: f32,
pub min_samples_leaf: usize,
/* private fields */
}Expand description
Target Encoder
Encodes categorical features using target statistics. Useful for high-cardinality categorical features.
Fields§
§smoothing: f32§min_samples_leaf: usizeImplementations§
Source§impl TargetEncoder
impl TargetEncoder
pub fn new() -> Self
pub fn smoothing(self, value: f32) -> Self
pub fn min_samples_leaf(self, value: usize) -> Self
Sourcepub fn fit(&mut self, categories: &[String], target: &[f32])
pub fn fit(&mut self, categories: &[String], target: &[f32])
Fit encoder on categorical features and target
Sourcepub fn transform(&self, categories: &[String]) -> Vec<f32>
pub fn transform(&self, categories: &[String]) -> Vec<f32>
Transform categories to encoded values
pub fn fit_transform( &mut self, categories: &[String], target: &[f32], ) -> Vec<f32>
Auto Trait Implementations§
impl Freeze for TargetEncoder
impl RefUnwindSafe for TargetEncoder
impl Send for TargetEncoder
impl Sync for TargetEncoder
impl Unpin for TargetEncoder
impl UnwindSafe for TargetEncoder
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> 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