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>
FirstShim< T > CreateNVP(T &t, const std::string &name, typename boost::enable_if< HasSerialize< T >>::type *=0)
Call this function to produce a name-value pair; this is similar to BOOST_SERIALIZATION_NVP(), but should be used for types that have a Serialize() function (or contain a type that has a Serialize() function) instead of a serialize() function.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Serialize(Archive &ar, const unsigned int)
Serialize the kernel.
double & Offset()
Modify the offset of the dot product of the arguments.
double Evaluate(const VecTypeA &a, const VecTypeB &b) const
Simple evaluation of the dot product.
const double & Degree() const
Get the degree of the polynomial.
The simple polynomial kernel.
const double & Offset() const
Get the offset of the dot product of the arguments.
double & Degree()
Modify the degree of the polynomial.
PolynomialKernel(const double degree=2.0, const double offset=0.0)
Construct the Polynomial Kernel with the given offset and degree.