Struct linfa_kernel::KernelParams [−][src]
pub struct KernelParams<F, N = CommonNearestNeighbour> { /* fields omitted */ }
Expand description
Defines the set of parameters needed to build a kernel
Implementations
Setter for method
, the inner product used by the kernel
Setter for kind
, whether to construct a dense or sparse kernel
Trait Implementations
Builds a kernel from a view of the input data.
Parameters
x
: view of a matrix of records (#records, #features)
A kernel build from x
according to the parameters on which
this method is called
Panics
If the kernel type is Sparse
and the number of neighbors specified is
not between 1 and #records-1
Builds a kernel from a view of the input data.
Parameters
x
: view of a matrix of records (#records, #features)
A kernel build from x
according to the parameters on which
this method is called
Panics
If the kernel type is Sparse
and the number of neighbors specified is
not between 1 and #records-1
impl<'a, F: Float, L: 'a, T: AsTargets<Elem = L> + FromTargetArray<'a, L>, 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, Global>, Vec<usize, Global>, Vec<F, Global>, usize>>, <T as FromTargetArray<'a, L>>::View>> for KernelParams<F, N>
impl<'a, F: Float, L: 'a, T: AsTargets<Elem = L> + FromTargetArray<'a, L>, 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, Global>, Vec<usize, Global>, Vec<F, Global>, usize>>, <T as FromTargetArray<'a, L>>::View>> for KernelParams<F, N>
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
impl<'a, 'b, F: Float, L: 'b, T: AsTargets<Elem = L> + FromTargetArray<'b, L>, 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, Global>, Vec<usize, Global>, Vec<F, Global>, usize>>, <T as FromTargetArray<'b, L>>::View>> for KernelParams<F, N>
impl<'a, 'b, F: Float, L: 'b, T: AsTargets<Elem = L> + FromTargetArray<'b, L>, 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, Global>, Vec<usize, Global>, Vec<F, Global>, usize>>, <T as FromTargetArray<'b, L>>::View>> for KernelParams<F, N>
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
Builds a kernel from a view of the input data.
Parameters
x
: view of a matrix of records (#records, #features)
A kernel build from x
according to the parameters on which
this method is called
Panics
If the kernel type is Sparse
and the number of neighbors specified is
not between 1 and #records-1
impl<'a, 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, Global>, Vec<usize, Global>, Vec<F, Global>, usize>>, T>> for KernelParams<F, N>
impl<'a, 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, Global>, Vec<usize, Global>, Vec<F, Global>, usize>>, T>> for KernelParams<F, N>
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