mlpack 3.4.2
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>
25
26namespace mlpack {
27namespace 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
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.
const std::vector< std::vector< std::map< std::string, int > > > & Counts() const
Access 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.
size_t P() const
Access the value of p.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.