pub struct AdditiveChi2Sampler { /* private fields */ }Expand description
Additive Chi-Squared Sampler
Approximate feature map for additive chi-squared kernel using random sampling. The additive chi-squared kernel is defined as: k(x, y) = exp(-gamma * sum_i (x_i - y_i)² / (x_i + y_i))
§Parameters
sample_steps- Number of sampling stepssample_interval- Interval for samplingn_components- Number of components to generate
§Examples
use sklears_feature_extraction::interaction::AdditiveChi2Sampler;
use scirs2_core::ndarray::array;
let X = array![[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]];
let sampler = AdditiveChi2Sampler::new()
.sample_steps(2)
.sample_interval(0.5);
let features = sampler.transform(&X.view()).expect("valid input produces transform output");Implementations§
Source§impl AdditiveChi2Sampler
impl AdditiveChi2Sampler
Sourcepub fn sample_steps(self, sample_steps: usize) -> Self
pub fn sample_steps(self, sample_steps: usize) -> Self
Set the number of sampling steps
Sourcepub fn sample_interval(self, sample_interval: Float) -> Self
pub fn sample_interval(self, sample_interval: Float) -> Self
Set the sampling interval
Sourcepub fn transform(&self, X: &ArrayView2<'_, Float>) -> SklResult<Array2<Float>>
pub fn transform(&self, X: &ArrayView2<'_, Float>) -> SklResult<Array2<Float>>
Transform data using additive chi-squared features
Sourcepub fn get_n_output_features(&self, n_input_features: usize) -> usize
pub fn get_n_output_features(&self, n_input_features: usize) -> usize
Get the number of output features
Trait Implementations§
Source§impl Clone for AdditiveChi2Sampler
impl Clone for AdditiveChi2Sampler
Source§impl Debug for AdditiveChi2Sampler
impl Debug for AdditiveChi2Sampler
Source§impl Default for AdditiveChi2Sampler
impl Default for AdditiveChi2Sampler
Auto Trait Implementations§
impl Freeze for AdditiveChi2Sampler
impl RefUnwindSafe for AdditiveChi2Sampler
impl Send for AdditiveChi2Sampler
impl Sync for AdditiveChi2Sampler
impl Unpin for AdditiveChi2Sampler
impl UnsafeUnpin for AdditiveChi2Sampler
impl UnwindSafe for AdditiveChi2Sampler
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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