pub trait LabelTransformer: Estimator {
// Required methods
fn name(&self) -> &'static str;
fn fit(&mut self, x: &[String]) -> Result<()>;
fn transform(&self, x: &[String]) -> Result<Vec<usize>>;
fn inverse_transform(&self, x: &[usize]) -> Result<Vec<String>>;
fn is_fitted(&self) -> bool;
// Provided method
fn fit_transform(&mut self, x: &[String]) -> Result<Vec<usize>> { ... }
}Expand description
Trait for 1-D label encoders that map &[String] to Vec<usize>.
Used to encode target labels for supervised learning.
Required Methods§
Sourcefn fit(&mut self, x: &[String]) -> Result<()>
fn fit(&mut self, x: &[String]) -> Result<()>
Fit on label data, learning the unique sorted classes.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".