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: f64Scaling of the inner product.
c: f64Constant added to inner product.
d: f64The power to raise the sum to.
Implementations§
Source§impl 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§
Source§impl Clone for Polynomial
impl Clone for Polynomial
Source§fn clone(&self) -> Polynomial
fn clone(&self) -> Polynomial
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Polynomial
impl Debug for Polynomial
Source§impl Default for Polynomial
Construct a new polynomial kernel.
impl Default for Polynomial
Construct a new polynomial kernel.
The defaults are:
- alpha = 1
- c = 0
- d = 1
Source§fn default() -> Polynomial
fn default() -> Polynomial
Returns the “default value” for a type. Read more
Source§impl Kernel for Polynomial
impl Kernel for Polynomial
impl Copy for Polynomial
Auto Trait Implementations§
impl Freeze for Polynomial
impl RefUnwindSafe for Polynomial
impl Send for Polynomial
impl Sync for Polynomial
impl Unpin for Polynomial
impl UnwindSafe for Polynomial
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