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>

source

pub fn method(self, method: KernelMethod<F>) -> Self

Setter for method, the inner product used by the kernel

source

pub fn kind(self, kind: KernelType) -> Self

Setter for kind, whether to construct a dense or sparse kernel

source

pub fn nn_algo(self, nn_algo: N) -> Self

Setter for nn_algo, nearest neighbour algorithm for calculating adjacency matrices

Trait Implementations§

source§

impl<F: Clone, N: Clone> Clone for KernelParams<F, N>

source§

fn clone(&self) -> KernelParams<F, N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<F: Debug, N: Debug> Debug for KernelParams<F, N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<F: PartialEq, N: PartialEq> PartialEq for KernelParams<F, N>

source§

fn eq(&self, other: &KernelParams<F, N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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§

fn transform(&self, x: &Array2<F>) -> Kernel<F>

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

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>

source§

fn transform(&self, x: &ArrayView2<'a, F>) -> Kernel<F>

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

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>

source§

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>

source§

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>

source§

fn transform(&self, x: ArrayView2<'a, F>) -> Kernel<F>

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

source§

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>, Vec<usize>, Vec<F>>>, T>> for KernelParams<F, N>

source§

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

source§

impl<F, N> StructuralPartialEq for KernelParams<F, N>

Auto Trait Implementations§

§

impl<F, N> RefUnwindSafe for KernelParams<F, N>where F: RefUnwindSafe, N: RefUnwindSafe,

§

impl<F, N> Send for KernelParams<F, N>where F: Send, N: Send,

§

impl<F, N> Sync for KernelParams<F, N>where F: Sync, N: Sync,

§

impl<F, N> Unpin for KernelParams<F, N>where F: Unpin, N: Unpin,

§

impl<F, N> UnwindSafe for KernelParams<F, N>where F: UnwindSafe, N: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V