pub struct PolynomialFeatures<State = Untrained> { /* private fields */ }Expand description
PolynomialFeatures generates polynomial and interaction features
Generate a new feature matrix consisting of all polynomial combinations of the features with degree less than or equal to the specified degree. For example, if an input sample is two dimensional and of the form [a, b], the degree-2 polynomial features are [1, a, b, a^2, ab, b^2].
Implementations§
Source§impl PolynomialFeatures<Untrained>
impl PolynomialFeatures<Untrained>
Sourcepub fn with_config(config: PolynomialFeaturesConfig) -> Self
pub fn with_config(config: PolynomialFeaturesConfig) -> Self
Create a new PolynomialFeatures with custom configuration
Sourcepub fn interaction_only(self, interaction_only: bool) -> Self
pub fn interaction_only(self, interaction_only: bool) -> Self
Set whether to include only interaction terms
Sourcepub fn include_bias(self, include_bias: bool) -> Self
pub fn include_bias(self, include_bias: bool) -> Self
Set whether to include bias term
Sourcepub fn interaction_depth(self, depth: Option<usize>) -> Self
pub fn interaction_depth(self, depth: Option<usize>) -> Self
Set maximum depth of interactions
Sourcepub fn max_features(self, max_features: Option<usize>) -> Self
pub fn max_features(self, max_features: Option<usize>) -> Self
Set maximum number of features
Sourcepub fn with_feature_selection(self, alpha: Float) -> Self
pub fn with_feature_selection(self, alpha: Float) -> Self
Enable feature selection
Source§impl<State> PolynomialFeatures<State>
Static methods for PolynomialFeatures
impl<State> PolynomialFeatures<State>
Static methods for PolynomialFeatures
Trait Implementations§
Source§impl<State: Clone> Clone for PolynomialFeatures<State>
impl<State: Clone> Clone for PolynomialFeatures<State>
Source§fn clone(&self) -> PolynomialFeatures<State>
fn clone(&self) -> PolynomialFeatures<State>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<State: Debug> Debug for PolynomialFeatures<State>
impl<State: Debug> Debug for PolynomialFeatures<State>
Source§impl Default for PolynomialFeatures<Untrained>
impl Default for PolynomialFeatures<Untrained>
Source§impl Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ()> for PolynomialFeatures<Untrained>
impl Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ()> for PolynomialFeatures<Untrained>
Source§type Fitted = PolynomialFeatures<Trained>
type Fitted = PolynomialFeatures<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<State> Freeze for PolynomialFeatures<State>
impl<State> RefUnwindSafe for PolynomialFeatures<State>where
State: RefUnwindSafe,
impl<State> Send for PolynomialFeatures<State>where
State: Send,
impl<State> Sync for PolynomialFeatures<State>where
State: Sync,
impl<State> Unpin for PolynomialFeatures<State>where
State: Unpin,
impl<State> UnwindSafe for PolynomialFeatures<State>where
State: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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