mlpack  2.0.1
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 VecTypeA, typename VecTypeB>
43  static double Evaluate(const VecTypeA& a, const VecTypeB& b);
44 
46  template<typename Archive>
47  void Serialize(Archive& /* ar */, const unsigned int /* version */) { }
48 };
49 
51 template<>
53 {
54  public:
56  static const bool IsNormalized = true;
57 
59  static const bool UsesSquaredDistance = false;
60 };
61 
62 } // namespace kernel
63 } // namespace mlpack
64 
65 // Include implementation.
66 #include "cosine_distance_impl.hpp"
67 
68 #endif
void Serialize(Archive &, const unsigned int)
Serialize the class (there's nothing to save).
This is a template class that can provide information about various kernels.
Linear algebra utility functions, generally performed on matrices or vectors.
The cosine distance (or cosine similarity).
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
static double Evaluate(const VecTypeA &a, const VecTypeB &b)
Computes the cosine distance between two points.
static const bool UsesSquaredDistance
If true, then the kernel include a squared distance, ||x - y||^2 .
static const bool IsNormalized
If true, then the kernel is normalized: K(x, x) = K(y, y) = 1 for all x.