mlpack  1.0.12
cosine_distance.hpp
Go to the documentation of this file.
1 
15 #ifndef __MLPACK_CORE_KERNELS_COSINE_DISTANCE_HPP
16 #define __MLPACK_CORE_KERNELS_COSINE_DISTANCE_HPP
17 
18 #include <mlpack/core.hpp>
19 
20 namespace mlpack {
21 namespace kernel {
22 
33 {
34  public:
42  template<typename VecType>
43  static double Evaluate(const VecType& a, const VecType& b);
44 
48  std::string ToString() const
49  {
50  std::ostringstream convert;
51  convert << "CosineDistance [" << this << "]" << std::endl;
52  return convert.str();
53  }
54 };
55 
57 template<>
59 {
60  public:
62  static const bool IsNormalized = true;
63 };
64 
65 }; // namespace kernel
66 }; // namespace mlpack
67 
68 // Include implementation.
69 #include "cosine_distance_impl.hpp"
70 
71 #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:23
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.