#[non_exhaustive]pub struct PolynomialFeatures { /* private fields */ }Expand description
Generate polynomial and interaction features.
Transforms an input feature set [x1, x2, …] into all polynomial
combinations up to a given degree. For example, with degree=2 and
2 features:
include_bias=true:[1, x1, x2, x1², x1·x2, x2²]interaction_only=true:[1, x1, x2, x1·x2](no self-powers)
§Example
ⓘ
let mut poly = PolynomialFeatures::new().degree(2);
poly.fit_transform(&mut ds)?;Implementations§
Source§impl PolynomialFeatures
impl PolynomialFeatures
Sourcepub fn interaction_only(self, v: bool) -> Self
pub fn interaction_only(self, v: bool) -> Self
If true, only interaction features are produced (no self-powers like x²).
Sourcepub fn include_bias(self, v: bool) -> Self
pub fn include_bias(self, v: bool) -> Self
If true, include a bias (all-ones) column.
Sourcepub fn n_output_features(&self) -> usize
pub fn n_output_features(&self) -> usize
Number of output features after transform.
Trait Implementations§
Source§impl Clone for PolynomialFeatures
impl Clone for PolynomialFeatures
Source§fn clone(&self) -> PolynomialFeatures
fn clone(&self) -> PolynomialFeatures
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PolynomialFeatures
impl Debug for PolynomialFeatures
Source§impl Default for PolynomialFeatures
impl Default for PolynomialFeatures
Auto Trait Implementations§
impl Freeze for PolynomialFeatures
impl RefUnwindSafe for PolynomialFeatures
impl Send for PolynomialFeatures
impl Sync for PolynomialFeatures
impl Unpin for PolynomialFeatures
impl UnsafeUnpin for PolynomialFeatures
impl UnwindSafe for PolynomialFeatures
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