Struct linfa_kernel::KernelBase [−][src]
pub struct KernelBase<K1: Inner, K2: Inner> where
K1::Elem: Float,
K2::Elem: Float, {
pub inner: KernelInner<K1, K2>,
pub method: KernelMethod<K1::Elem>,
}
Expand description
A generic kernel
Fields
inner: KernelInner<K1, K2>
method: KernelMethod<K1::Elem>
The inner product that will be used by the kernel
Implementations
Generates the default set of parameters for building a kernel.
Use this to initialize a set of parameters to be customized using KernelParams
’s methods
Generate parameters with a specific nearest neighbour algorithm
Performs the matrix product between the kernel matrix and the input
Parameters
rhs
: The matrix on the right-hand side of the multiplication
Returns
A new matrix containing the matrix product between the kernel
and rhs
Panics
If the shapes of kernel and rhs
are not compatible for multiplication
Sums all elements in the same row of the kernel matrix
Returns
A new array with the sum of all the elements in each row
Getter for the data in the upper triangle of the kernel matrix
Returns
A copy of all elements in the upper triangle of the kernel
matrix, stored in a Vec
pub fn new<N: NearestNeighbour>(
dataset: ArrayView2<'a, F>,
params: &KernelParams<F, N>
) -> Kernel<F>
Gives a KernelView which has a view on the original kernel’s inner matrix
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
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