22 #ifndef __MLPACK_CORE_KERNELS_TRIANGULAR_KERNEL_HPP
23 #define __MLPACK_CORE_KERNELS_TRIANGULAR_KERNEL_HPP
56 template<
typename Vec1Type,
typename Vec2Type>
57 double Evaluate(
const Vec1Type& a,
const Vec2Type& b)
const
71 return std::max(0.0, (1 - distance) /
bandwidth);
82 std::ostringstream convert;
83 convert <<
"TriangularKernel [" <<
this <<
"]" << std::endl;
84 convert <<
" Bandwidth: " <<
bandwidth << std::endl;
This is a template class that can provide information about various kernels.
Linear algebra utility functions, generally performed on matrices or vectors.
The trivially simple triangular kernel, defined by.
double Evaluate(const double distance) const
Evaluate the triangular kernel given that the distance between the two points is known.
double Evaluate(const Vec1Type &a, const Vec2Type &b) const
Evaluate the triangular kernel for the two given vectors.
std::string ToString() const
Return a string representation of the kernel.
double bandwidth
The bandwidth of the kernel.
double & Bandwidth()
Modify the bandwidth of the kernel.
TriangularKernel(const double bandwidth=1.0)
Initialize the triangular kernel with the given bandwidth (default 1.0).
static double Evaluate(const VecType1 &a, const VecType2 &b)
Computes the distance between two points.
static const bool IsNormalized
If true, then the kernel is normalized: K(x, x) = K(y, y) = 1 for all x.
double Bandwidth() const
Get the bandwidth of the kernel.