SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WeightedCommWordStringKernel.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 1999-2009 Soeren Sonnenburg
8  * Written (W) 1999-2008 Gunnar Raetsch
9  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
10  */
11 
12 #ifndef _WEIGHTEDCOMMWORDSTRINGKERNEL_H___
13 #define _WEIGHTEDCOMMWORDSTRINGKERNEL_H___
14 
15 #include <shogun/lib/config.h>
16 
17 #include <shogun/lib/common.h>
20 
21 namespace shogun
22 {
23 class CCommWordStringKernel;
24 
53 {
54  public:
57 
63  CWeightedCommWordStringKernel(int32_t size, bool use_sign);
64 
74  bool use_sign=false, int32_t size=10);
75 
77 
84  virtual bool init(CFeatures* l, CFeatures* r);
85 
87  virtual void cleanup();
88 
94  virtual float64_t compute_optimized(int32_t idx);
95 
101  virtual void add_to_normal(int32_t idx, float64_t weight);
102 
104  void merge_normal();
105 
110  bool set_wd_weights();
111 
118 
124 
129  virtual const char* get_name() const { return "WeightedCommWordStringKernel"; }
130 
135  virtual EFeatureType get_feature_type() { return F_WORD; }
136 
149  virtual float64_t* compute_scoring(
150  int32_t max_degree, int32_t& num_feat, int32_t& num_sym,
151  float64_t* target, int32_t num_suppvec, int32_t* IDX,
152  float64_t* alphas, bool do_init=true);
153 
154  protected:
161  virtual float64_t compute_helper(
162  int32_t idx_a, int32_t idx_b, bool do_sort);
163 
164  private:
165  void init();
166 
167  protected:
169  int32_t degree;
170 
173 };
174 }
175 #endif /* _WEIGHTEDCOMMWORDSTRINGKERNEL_H__ */

SHOGUN Machine Learning Toolbox - Documentation