mlpack  2.0.1
pspectrum_string_kernel.hpp
Go to the documentation of this file.
1 
18 #ifndef __MLPACK_CORE_KERNELS_PSPECTRUM_STRING_KERNEL_HPP
19 #define __MLPACK_CORE_KERNELS_PSPECTRUM_STRING_KERNEL_HPP
20 
21 #include <map>
22 #include <string>
23 #include <vector>
24 
25 #include <mlpack/core.hpp>
26 
27 namespace mlpack {
28 namespace kernel {
29 
67 {
68  public:
76  PSpectrumStringKernel(const std::vector<std::vector<std::string> >& datasets,
77  const size_t p);
78 
90  template<typename VecType>
91  double Evaluate(const VecType& a, const VecType& b) const;
92 
94  const std::vector<std::vector<std::map<std::string, int> > >& Counts() const
95  { return counts; }
97  std::vector<std::vector<std::map<std::string, int> > >& Counts()
98  { return counts; }
99 
101  size_t P() const { return p; }
103  size_t& P() { return p; }
104 
105  private:
107  const std::vector<std::vector<std::string> >& datasets;
108 
111  std::vector<std::vector<std::map<std::string, int> > > counts;
112 
114  size_t p;
115 };
116 
117 } // namespace kernel
118 } // namespace mlpack
119 
120 // Include implementation of templated Evaluate().
121 #include "pspectrum_string_kernel_impl.hpp"
122 
123 #endif
const std::vector< std::vector< std::map< std::string, int > > > & Counts() const
Access the lists of substrings.
double Evaluate(const VecType &a, const VecType &b) const
Evaluate the kernel for the string indices given.
Linear algebra utility functions, generally performed on matrices or vectors.
const std::vector< std::vector< std::string > > & datasets
The datasets.
PSpectrumStringKernel(const std::vector< std::vector< std::string > > &datasets, const size_t p)
Initialize the PSpectrumStringKernel with the given string datasets.
size_t p
The value of p to use in calculation.
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
std::vector< std::vector< std::map< std::string, int > > > counts
Mappings of the datasets to counts of substrings.
size_t P() const
Access the value of p.
std::vector< std::vector< std::map< std::string, int > > > & Counts()
Modify the lists of substrings.