pspectrum_string_kernel.hpp
Go to the documentation of this file.
1 
16 #ifndef MLPACK_CORE_KERNELS_PSPECTRUM_STRING_KERNEL_HPP
17 #define MLPACK_CORE_KERNELS_PSPECTRUM_STRING_KERNEL_HPP
18 
19 #include <map>
20 #include <string>
21 #include <vector>
22 
23 #include <mlpack/prereqs.hpp>
24 #include <mlpack/core/util/log.hpp>
25 
26 namespace mlpack {
27 namespace kernel {
28 
66 {
67  public:
75  PSpectrumStringKernel(const std::vector<std::vector<std::string> >& datasets,
76  const size_t p);
77 
89  template<typename VecType>
90  double Evaluate(const VecType& a, const VecType& b) const;
91 
93  const std::vector<std::vector<std::map<std::string, int> > >& Counts() const
94  { return counts; }
96  std::vector<std::vector<std::map<std::string, int> > >& Counts()
97  { return counts; }
98 
100  size_t P() const { return p; }
102  size_t& P() { return p; }
103 
104  private:
107  std::vector<std::vector<std::map<std::string, int> > > counts;
108 
110  size_t p;
111 };
112 
113 } // namespace kernel
114 } // namespace mlpack
115 
116 // Include implementation of templated Evaluate().
117 #include "pspectrum_string_kernel_impl.hpp"
118 
119 #endif
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
size_t P() const
Access the value of p.
double Evaluate(const VecType &a, const VecType &b) const
Evaluate the kernel for the string indices given.
std::vector< std::vector< std::map< std::string, int > > > & Counts()
Modify the lists of substrings.
PSpectrumStringKernel(const std::vector< std::vector< std::string > > &datasets, const size_t p)
Initialize the PSpectrumStringKernel with the given string datasets.
const std::vector< std::vector< std::map< std::string, int > > > & Counts() const
Access the lists of substrings.