12 #ifndef MLPACK_CORE_KERNELS_POLYNOMIAL_KERNEL_HPP 13 #define MLPACK_CORE_KERNELS_POLYNOMIAL_KERNEL_HPP 54 template<
typename VecTypeA,
typename VecTypeB>
55 double Evaluate(
const VecTypeA& a,
const VecTypeB& b)
const 57 return pow((arma::dot(a, b) + offset), degree);
61 const double&
Degree()
const {
return degree; }
66 const double&
Offset()
const {
return offset; }
71 template<
typename Archive>
74 ar(CEREAL_NVP(degree));
75 ar(CEREAL_NVP(offset));
PolynomialKernel(const double degree=2.0, const double offset=0.0)
Construct the Polynomial Kernel with the given offset and degree.
Definition: polynomial_kernel.hpp:38
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
double & Offset()
Modify the offset of the dot product of the arguments.
Definition: polynomial_kernel.hpp:68
The core includes that mlpack expects; standard C++ includes and Armadillo.
const double & Offset() const
Get the offset of the dot product of the arguments.
Definition: polynomial_kernel.hpp:66
const double & Degree() const
Get the degree of the polynomial.
Definition: polynomial_kernel.hpp:61
The simple polynomial kernel.
Definition: polynomial_kernel.hpp:28
double & Degree()
Modify the degree of the polynomial.
Definition: polynomial_kernel.hpp:63
double Evaluate(const VecTypeA &a, const VecTypeB &b) const
Simple evaluation of the dot product.
Definition: polynomial_kernel.hpp:55
void serialize(Archive &ar, const uint32_t)
Serialize the kernel.
Definition: polynomial_kernel.hpp:72