26 #ifndef __MLPACK_CORE_KERNELS_PSPECTRUM_STRING_KERNEL_HPP 27 #define __MLPACK_CORE_KERNELS_PSPECTRUM_STRING_KERNEL_HPP 98 template<
typename VecType>
99 double Evaluate(
const VecType& a,
const VecType& b)
const;
102 const std::vector<std::vector<std::map<std::string, int> > >&
Counts()
const 105 std::vector<std::vector<std::map<std::string, int> > >&
Counts()
109 size_t P()
const {
return p; }
111 size_t&
P() {
return p; }
117 std::ostringstream convert;
118 convert <<
"PSpectrumStringKernel [" <<
this <<
"]" << std::endl;
119 convert <<
" p used: " << p << std::endl;
120 convert <<
" Dataset:" <<
datasets.size() << std::endl;
121 std::ostringstream convertb;
122 for (
size_t ind=0; ind <
datasets.size(); ind++)
125 return convert.str();
129 const std::vector<std::vector<std::string> >&
datasets;
133 std::vector<std::vector<std::map<std::string, int> > >
counts;
143 #include "pspectrum_string_kernel_impl.hpp" Linear algebra utility functions, generally performed on matrices or vectors.
const std::vector< std::vector< std::string > > & datasets
The datasets.
size_t & P()
Modify the value of p.
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::string Indent(std::string input, const size_t howManyTabs=1)
A utility function that replaces all all newlines with a number of spaces depending on the indentatio...
The p-spectrum string kernel.
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.
std::string ToString() const