12 #ifndef MLPACK_CORE_KERNELS_HYPERBOLIC_TANGENT_KERNEL_HPP
13 #define MLPACK_CORE_KERNELS_HYPERBOLIC_TANGENT_KERNEL_HPP
45 scale(scale), offset(offset)
59 template<
typename VecTypeA,
typename VecTypeB>
60 double Evaluate(
const VecTypeA& a,
const VecTypeB& b)
62 return tanh(scale * arma::dot(a, b) + offset);
66 double Scale()
const {
return scale; }
68 double&
Scale() {
return scale; }
71 double Offset()
const {
return offset; }
76 template<
typename Archive>
double Offset() const
Get offset for the kernel.
double Evaluate(const VecTypeA &a, const VecTypeB &b)
Evaluate the hyperbolic tangent kernel.
HyperbolicTangentKernel(double scale, double offset)
Construct the hyperbolic tangent kernel with custom scale factor and offset.
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.
Hyperbolic tangent kernel.
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Scale() const
Get scale factor.
void Serialize(Archive &ar, const unsigned int)
Serialize the kernel.
double & Scale()
Modify scale factor.
HyperbolicTangentKernel()
This constructor sets the default scale to 1.0 and offset to 0.0.
double & Offset()
Modify offset for the kernel.