pub struct FunctionTransformer<F, G, State = Untrained>where
F: Fn(&Array2<Float>) -> Result<Array2<Float>> + Send + Sync,
G: Fn(&Array2<Float>) -> Result<Array2<Float>> + Send + Sync,{ /* private fields */ }Expand description
FunctionTransformer applies arbitrary functions to transform data
This transformer is useful for stateless transformations such as taking the log, square root, or any other function. Unlike most other transformers, FunctionTransformer does not require fitting.
Implementations§
Source§impl<F, G> FunctionTransformer<F, G, Untrained>
impl<F, G> FunctionTransformer<F, G, Untrained>
Sourcepub fn inverse_func(self, inverse_func: G) -> Self
pub fn inverse_func(self, inverse_func: G) -> Self
Set the inverse function
Sourcepub fn check_inverse(self, check_inverse: bool) -> Self
pub fn check_inverse(self, check_inverse: bool) -> Self
Set whether to check inverse
Source§impl<F, G> FunctionTransformer<F, G, Trained>
impl<F, G> FunctionTransformer<F, G, Trained>
Sourcepub fn n_features_in(&self) -> usize
pub fn n_features_in(&self) -> usize
Get the number of input features
Trait Implementations§
Source§impl<F, G> Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ()> for FunctionTransformer<F, G, Untrained>
impl<F, G> Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ()> for FunctionTransformer<F, G, Untrained>
Source§type Fitted = FunctionTransformer<F, G, Trained>
type Fitted = FunctionTransformer<F, G, Trained>
The fitted model type
Source§fn fit(self, x: &Array2<Float>, _y: &()) -> Result<Self::Fitted>
fn fit(self, x: &Array2<Float>, _y: &()) -> Result<Self::Fitted>
Fit the model to the provided data with validation
Source§fn fit_with_validation(
self,
x: &X,
y: &Y,
_x_val: Option<&X>,
_y_val: Option<&Y>,
) -> Result<(Self::Fitted, FitMetrics), SklearsError>where
Self: Sized,
fn fit_with_validation(
self,
x: &X,
y: &Y,
_x_val: Option<&X>,
_y_val: Option<&Y>,
) -> Result<(Self::Fitted, FitMetrics), SklearsError>where
Self: Sized,
Fit with custom validation and early stopping
Auto Trait Implementations§
impl<F, G, State> Freeze for FunctionTransformer<F, G, State>
impl<F, G, State> RefUnwindSafe for FunctionTransformer<F, G, State>
impl<F, G, State> Send for FunctionTransformer<F, G, State>where
State: Send,
impl<F, G, State> Sync for FunctionTransformer<F, G, State>where
State: Sync,
impl<F, G, State> Unpin for FunctionTransformer<F, G, State>
impl<F, G, State> UnwindSafe for FunctionTransformer<F, G, State>
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