pub struct ProductKernel { /* private fields */ }Expand description
Product of multiple kernels: K(x,y) = Π_i K_i(x,y)
Combines kernels through multiplication. The resulting kernel corresponds to the tensor product of feature spaces.
§Example
use tensorlogic_sklears_kernels::{
LinearKernel, CosineKernel,
ProductKernel, Kernel
};
let linear = Box::new(LinearKernel::new()) as Box<dyn Kernel>;
let cosine = Box::new(CosineKernel::new()) as Box<dyn Kernel>;
let product = ProductKernel::new(vec![linear, cosine]).unwrap();
let x = vec![1.0, 2.0, 3.0];
let y = vec![4.0, 5.0, 6.0];
let sim = product.compute(&x, &y).unwrap();
// sim = linear(x,y) * cosine(x,y)Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProductKernel
impl !RefUnwindSafe for ProductKernel
impl Send for ProductKernel
impl Sync for ProductKernel
impl Unpin for ProductKernel
impl !UnwindSafe for ProductKernel
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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