MLPACK  1.0.8
pspectrum_string_kernel.hpp
Go to the documentation of this file.
1 
26 #ifndef __MLPACK_CORE_KERNELS_PSPECTRUM_STRING_KERNEL_HPP
27 #define __MLPACK_CORE_KERNELS_PSPECTRUM_STRING_KERNEL_HPP
28 
29 #include <map>
30 #include <string>
31 #include <vector>
32 
33 #include <mlpack/core.hpp>
34 
35 namespace mlpack {
36 namespace kernel {
37 
75 {
76  public:
84  PSpectrumStringKernel(const std::vector<std::vector<std::string> >& datasets,
85  const size_t p);
86 
98  template<typename VecType>
99  double Evaluate(const VecType& a, const VecType& b) const;
100 
102  const std::vector<std::vector<std::map<std::string, int> > >& Counts() const
103  { return counts; }
105  std::vector<std::vector<std::map<std::string, int> > >& Counts()
106  { return counts; }
107 
109  size_t P() const { return p; }
111  size_t& P() { return p; }
112 
113  private:
115  const std::vector<std::vector<std::string> >& datasets;
116 
119  std::vector<std::vector<std::map<std::string, int> > > counts;
120 
122  size_t p;
123 };
124 
125 }; // namespace kernel
126 }; // namespace mlpack
127 
128 // Include implementation of templated Evaluate().
129 #include "pspectrum_string_kernel_impl.hpp"
130 
131 #endif
const std::vector< std::vector< std::string > > & datasets
The datasets.
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.
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.
std::vector< std::vector< std::map< std::string, int > > > counts
Mappings of the datasets to counts of substrings.
std::vector< std::vector< std::map< std::string, int > > > & Counts()
Modify the lists of substrings.
size_t P() const
Access the value of p.