pub struct KernelSum<T, U>where
    T: Kernel,
    U: Kernel,
{ /* private fields */ }
Expand description

The sum of two kernels

This struct should not be directly instantiated but instead is created when we add two kernels together.

Note that it will be more efficient to implement the final kernel manually yourself. However this provides an easy mechanism to test different combinations.

Examples

use rusty_machine::learning::toolkit::kernel::{Kernel, Polynomial, HyperTan, KernelArith};

let poly_ker = Polynomial::new(1f64,2f64,3f64);
let hypert_ker = HyperTan::new(1f64,2.5);

let poly_plus_hypert_ker = KernelArith(poly_ker) + KernelArith(hypert_ker);

println!("{0}", poly_plus_hypert_ker.kernel(&[1f64,2f64,3f64],
                                            &[3f64,1f64,2f64]));

Trait Implementations

Formats the value using the given formatter. Read more

Computes the sum of the two associated kernels.

The kernel function. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.