pub struct KernelParams<F, N = CommonNearestNeighbour> { /* private fields */ }
Expand description
Defines the set of parameters needed to build a kernel
Implementations§
Source§impl<F, N> KernelParams<F, N>
impl<F, N> KernelParams<F, N>
Sourcepub fn method(self, method: KernelMethod<F>) -> Self
pub fn method(self, method: KernelMethod<F>) -> Self
Setter for method
, the inner product used by the kernel
Sourcepub fn kind(self, kind: KernelType) -> Self
pub fn kind(self, kind: KernelType) -> Self
Setter for kind
, whether to construct a dense or sparse kernel
Trait Implementations§
Source§impl<F: Clone, N: Clone> Clone for KernelParams<F, N>
impl<F: Clone, N: Clone> Clone for KernelParams<F, N>
Source§fn clone(&self) -> KernelParams<F, N>
fn clone(&self) -> KernelParams<F, N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<F: Float, N: NearestNeighbour> Transformer<&ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, KernelBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>>> for KernelParams<F, N>
impl<F: Float, N: NearestNeighbour> Transformer<&ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, KernelBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>>> for KernelParams<F, N>
Source§impl<'a, F: Float, N: NearestNeighbour> Transformer<&ArrayBase<ViewRepr<&'a F>, Dim<[usize; 2]>>, KernelBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>>> for KernelParams<F, N>
impl<'a, F: Float, N: NearestNeighbour> Transformer<&ArrayBase<ViewRepr<&'a F>, Dim<[usize; 2]>>, KernelBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>>> for KernelParams<F, N>
Source§fn transform(&self, x: &ArrayView2<'a, F>) -> Kernel<F>
fn transform(&self, x: &ArrayView2<'a, F>) -> Kernel<F>
Source§impl<'a, F: Float, L: 'a, T: AsTargets<Elem = L> + FromTargetArray<'a>, N: NearestNeighbour> Transformer<&'a DatasetBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, T>, DatasetBase<KernelBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>>, <T as FromTargetArray<'a>>::View>> for KernelParams<F, N>
impl<'a, F: Float, L: 'a, T: AsTargets<Elem = L> + FromTargetArray<'a>, N: NearestNeighbour> Transformer<&'a DatasetBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, T>, DatasetBase<KernelBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>>, <T as FromTargetArray<'a>>::View>> for KernelParams<F, N>
Source§fn transform(
&self,
x: &'a DatasetBase<Array2<F>, T>,
) -> DatasetBase<Kernel<F>, T::View>
fn transform( &self, x: &'a DatasetBase<Array2<F>, T>, ) -> DatasetBase<Kernel<F>, T::View>
Builds a new Dataset with the kernel as the records and the same targets as the input one.
§Parameters
x
: A dataset with a matrix of records (#records, #features) and any targets
§Returns
A new dataset with:
- records: a kernel build from
x.records()
according to the parameters on which this method is called - targets: same as
x.targets()
§Panics
If the kernel type is Sparse
and the number of neighbors specified is
not between 1 and #records-1
Source§impl<'a, 'b, F: Float, L: 'b, T: AsTargets<Elem = L> + FromTargetArray<'b>, N: NearestNeighbour> Transformer<&'b DatasetBase<ArrayBase<ViewRepr<&'a F>, Dim<[usize; 2]>>, T>, DatasetBase<KernelBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>>, <T as FromTargetArray<'b>>::View>> for KernelParams<F, N>
impl<'a, 'b, F: Float, L: 'b, T: AsTargets<Elem = L> + FromTargetArray<'b>, N: NearestNeighbour> Transformer<&'b DatasetBase<ArrayBase<ViewRepr<&'a F>, Dim<[usize; 2]>>, T>, DatasetBase<KernelBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>>, <T as FromTargetArray<'b>>::View>> for KernelParams<F, N>
Source§fn transform(
&self,
x: &'b DatasetBase<ArrayView2<'a, F>, T>,
) -> DatasetBase<Kernel<F>, T::View>
fn transform( &self, x: &'b DatasetBase<ArrayView2<'a, F>, T>, ) -> DatasetBase<Kernel<F>, T::View>
Builds a new Dataset with the kernel as the records and the same targets as the input one.
§Parameters
x
: A dataset with a matrix of records (##records, ##features) and any targets
§Returns
A new dataset with:
- records: a kernel build from
x.records()
according to the parameters on which this method is called - targets: a slice of
x.targets()
§Panics
If the kernel type is Sparse
and the number of neighbors specified is
not between 1 and ##records-1
Source§impl<'a, F: Float, N: NearestNeighbour> Transformer<ArrayBase<ViewRepr<&'a F>, Dim<[usize; 2]>>, KernelBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>>> for KernelParams<F, N>
impl<'a, F: Float, N: NearestNeighbour> Transformer<ArrayBase<ViewRepr<&'a F>, Dim<[usize; 2]>>, KernelBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>>> for KernelParams<F, N>
Source§fn transform(&self, x: ArrayView2<'a, F>) -> Kernel<F>
fn transform(&self, x: ArrayView2<'a, F>) -> Kernel<F>
Source§impl<F: Float, T: AsTargets, N: NearestNeighbour> Transformer<DatasetBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, T>, DatasetBase<KernelBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>>, T>> for KernelParams<F, N>
impl<F: Float, T: AsTargets, N: NearestNeighbour> Transformer<DatasetBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, T>, DatasetBase<KernelBase<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>, CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>>, T>> for KernelParams<F, N>
Source§fn transform(&self, x: DatasetBase<Array2<F>, T>) -> DatasetBase<Kernel<F>, T>
fn transform(&self, x: DatasetBase<Array2<F>, T>) -> DatasetBase<Kernel<F>, T>
Builds a new Dataset with the kernel as the records and the same targets as the input one.
It takes ownership of the original dataset.
§Parameters
x
: A dataset with a matrix of records (#records, #features) and any targets
§Returns
A new dataset with:
- records: a kernel build from
x.records()
according to the parameters on which this method is called - targets: same as
x.targets()
§Panics
If the kernel type is Sparse
and the number of neighbors specified is
not between 1 and #records-1
impl<F, N> StructuralPartialEq for KernelParams<F, N>
Auto Trait Implementations§
impl<F, N> Freeze for KernelParams<F, N>
impl<F, N> RefUnwindSafe for KernelParams<F, N>where
N: RefUnwindSafe,
F: RefUnwindSafe,
impl<F, N> Send for KernelParams<F, N>
impl<F, N> Sync for KernelParams<F, N>
impl<F, N> Unpin for KernelParams<F, N>
impl<F, N> UnwindSafe for KernelParams<F, N>where
N: UnwindSafe,
F: 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
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>
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>
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