MLPACK  1.0.11
cosine_distance.hpp
Go to the documentation of this file.
1 
23 #ifndef __MLPACK_CORE_KERNELS_COSINE_DISTANCE_HPP
24 #define __MLPACK_CORE_KERNELS_COSINE_DISTANCE_HPP
25 
26 #include <mlpack/core.hpp>
27 
28 namespace mlpack {
29 namespace kernel {
30 
41 {
42  public:
50  template<typename VecType>
51  static double Evaluate(const VecType& a, const VecType& b);
52 
56  std::string ToString() const
57  {
58  std::ostringstream convert;
59  convert << "CosineDistance [" << this << "]" << std::endl;
60  return convert.str();
61  }
62 };
63 
65 template<>
67 {
68  public:
70  static const bool IsNormalized = true;
71 };
72 
73 }; // namespace kernel
74 }; // namespace mlpack
75 
76 // Include implementation.
77 #include "cosine_distance_impl.hpp"
78 
79 #endif
This is a template class that can provide information about various kernels.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: load.hpp:31
The cosine distance (or cosine similarity).
static double Evaluate(const VecType &a, const VecType &b)
Computes the cosine distance between two points.
std::string ToString() const
Returns a string representation of this object.
static const bool IsNormalized
If true, then the kernel is normalized: K(x, x) = K(y, y) = 1 for all x.