SHOGUN  v2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LinearMachine.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  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #ifndef _LINEARCLASSIFIER_H__
12 #define _LINEARCLASSIFIER_H__
13 
14 #include <shogun/lib/common.h>
15 #include <shogun/labels/Labels.h>
17 #include <shogun/machine/Machine.h>
18 
19 #include <stdio.h>
20 
21 namespace shogun
22 {
23  class CDotFeatures;
24  class CMachine;
25  class CLabels;
26 
61 class CLinearMachine : public CMachine
62 {
63  public:
66 
68  virtual ~CLinearMachine();
69 
72 
77  virtual SGVector<float64_t> get_w() const
78  {
79  return w;
80  }
81 
86  virtual void set_w(const SGVector<float64_t> src_w)
87  {
88  w=src_w;
89  }
90 
95  virtual void set_bias(float64_t b)
96  {
97  bias=b;
98  }
99 
104  virtual float64_t get_bias()
105  {
106  return bias;
107  }
108 
113  virtual inline void set_features(CDotFeatures* feat)
114  {
115  SG_REF(feat);
117  features=feat;
118  }
119 
126  virtual CBinaryLabels* apply_binary(CFeatures* data=NULL);
127 
134  virtual CRegressionLabels* apply_regression(CFeatures* data=NULL);
135 
137  virtual float64_t apply_one(int32_t vec_idx);
138 
144 
150  virtual const char* get_name() const { return "LinearMachine"; }
151 
153  virtual CMachine* clone()
154  {
155  return new CLinearMachine(this);
156  }
157 
158  protected:
159 
166 
171  virtual void store_model_features() {}
172 
173  private:
174 
175  void init();
176 
177  protected:
184 };
185 }
186 #endif

SHOGUN Machine Learning Toolbox - Documentation