mlpack
Public Member Functions | List of all members
mlpack::kernel::PolynomialKernel Class Reference

The simple polynomial kernel. More...

#include <polynomial_kernel.hpp>

Public Member Functions

 PolynomialKernel (const double degree=2.0, const double offset=0.0)
 Construct the Polynomial Kernel with the given offset and degree. More...
 
template<typename VecTypeA , typename VecTypeB >
double Evaluate (const VecTypeA &a, const VecTypeB &b) const
 Simple evaluation of the dot product. More...
 
const double & Degree () const
 Get the degree of the polynomial.
 
double & Degree ()
 Modify the degree of the polynomial.
 
const double & Offset () const
 Get the offset of the dot product of the arguments.
 
double & Offset ()
 Modify the offset of the dot product of the arguments.
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the kernel.
 

Detailed Description

The simple polynomial kernel.

For any two vectors \( x \), \( y \), \( degree \) and \( offset \),

\[ K(x, y) = (x^T * y + offset) ^ {degree}. \]

Constructor & Destructor Documentation

◆ PolynomialKernel()

mlpack::kernel::PolynomialKernel::PolynomialKernel ( const double  degree = 2.0,
const double  offset = 0.0 
)
inline

Construct the Polynomial Kernel with the given offset and degree.

If the arguments are omitted, the default degree is 2 and the default offset is 0.

Parameters
offsetOffset of the dot product of the arguments.
degreeDegree of the polynomial.

Member Function Documentation

◆ Evaluate()

template<typename VecTypeA , typename VecTypeB >
double mlpack::kernel::PolynomialKernel::Evaluate ( const VecTypeA &  a,
const VecTypeB &  b 
) const
inline

Simple evaluation of the dot product.

This evaluation uses Armadillo's dot() function.

Template Parameters
VecTypeAType of first vector (should be arma::vec or arma::sp_vec).
VecTypeBType of second vector (arma::vec / arma::sp_vec).
Parameters
aFirst vector.
bSecond vector.
Returns
K(a, b).

The documentation for this class was generated from the following file: