Struct rusty_machine::learning::toolkit::kernel::Polynomial
source · [−]pub struct Polynomial {
pub alpha: f64,
pub c: f64,
pub d: f64,
}
Expand description
The Polynomial Kernel
k(x,y) = (αxTy + c)d
Fields
alpha: f64
Scaling of the inner product.
c: f64
Constant added to inner product.
d: f64
The power to raise the sum to.
Implementations
sourceimpl Polynomial
impl Polynomial
sourcepub fn new(alpha: f64, c: f64, d: f64) -> Polynomial
pub fn new(alpha: f64, c: f64, d: f64) -> Polynomial
Constructs a new Polynomial Kernel.
Examples
use rusty_machine::learning::toolkit::kernel;
use rusty_machine::learning::toolkit::kernel::Kernel;
// Constructs a new polynomial with alpha = 1, c = 0, d = 2.
let ker = kernel::Polynomial::new(1.0, 0.0, 2.0);
println!("{0}", ker.kernel(&[1.,2.,3.], &[3.,4.,5.]));
Trait Implementations
sourceimpl Clone for Polynomial
impl Clone for Polynomial
sourcefn clone(&self) -> Polynomial
fn clone(&self) -> Polynomial
Returns a copy of the value. Read more
1.0.0const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for Polynomial
impl Debug for Polynomial
sourceimpl Default for Polynomial
impl Default for Polynomial
Construct a new polynomial kernel.
The defaults are:
- alpha = 1
- c = 0
- d = 1
sourcefn default() -> Polynomial
fn default() -> Polynomial
Returns the “default value” for a type. Read more
sourceimpl Kernel for Polynomial
impl Kernel for Polynomial
impl Copy for Polynomial
Auto Trait Implementations
impl RefUnwindSafe for Polynomial
impl Send for Polynomial
impl Sync for Polynomial
impl Unpin for Polynomial
impl UnwindSafe for Polynomial
Blanket Implementations
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ToOwned for Twhere
T: Clone,
impl<T> ToOwned for Twhere
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. Read more