SHOGUN  v3.0.0
 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/common.h>
18 
19 namespace shogun
20 {
21 class CCommWordStringKernel;
22 
51 {
52  public:
55 
61  CWeightedCommWordStringKernel(int32_t size, bool use_sign);
62 
72  bool use_sign=false, int32_t size=10);
73 
75 
82  virtual bool init(CFeatures* l, CFeatures* r);
83 
85  virtual void cleanup();
86 
92  virtual float64_t compute_optimized(int32_t idx);
93 
99  virtual void add_to_normal(int32_t idx, float64_t weight);
100 
102  void merge_normal();
103 
108  bool set_wd_weights();
109 
116 
122 
127  virtual const char* get_name() const { return "WeightedCommWordStringKernel"; }
128 
133  virtual EFeatureType get_feature_type() { return F_WORD; }
134 
147  virtual float64_t* compute_scoring(
148  int32_t max_degree, int32_t& num_feat, int32_t& num_sym,
149  float64_t* target, int32_t num_suppvec, int32_t* IDX,
150  float64_t* alphas, bool do_init=true);
151 
152  protected:
159  virtual float64_t compute_helper(
160  int32_t idx_a, int32_t idx_b, bool do_sort);
161 
162  private:
163  void init();
164 
165  protected:
167  int32_t degree;
168 
171 };
172 }
173 #endif /* _WEIGHTEDCOMMWORDSTRINGKERNEL_H__ */

SHOGUN Machine Learning Toolbox - Documentation