SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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/config.h>
15 
16 #include <shogun/lib/common.h>
17 #include <shogun/machine/Machine.h>
18 #include <shogun/lib/SGVector.h>
19 
20 
21 namespace shogun
22 {
23 
24 class CBinaryLabels;
25 class CDotFeatures;
26 class CFeatures;
27 class CRegressionLabels;
28 
63 class CLinearMachine : public CMachine
64 {
65  public:
68 
75 
77  virtual ~CLinearMachine();
78 
81 
86  virtual bool train(CFeatures* data=NULL);
87 
92  virtual SGVector<float64_t> get_w() const;
93 
98  virtual void set_w(const SGVector<float64_t> src_w);
99 
104  virtual void set_bias(float64_t b);
105 
110  virtual float64_t get_bias();
111 
117  virtual void set_compute_bias(bool compute_bias);
118 
123  virtual bool get_compute_bias();
124 
129  virtual void set_features(CDotFeatures* feat);
130 
137  virtual CBinaryLabels* apply_binary(CFeatures* data=NULL);
138 
145  virtual CRegressionLabels* apply_regression(CFeatures* data=NULL);
146 
148  virtual float64_t apply_one(int32_t vec_idx);
149 
154  virtual CDotFeatures* get_features();
155 
161  virtual const char* get_name() const { return "LinearMachine"; }
162 
163  protected:
164 
171 
176  virtual void store_model_features();
177 
182  void compute_bias(CFeatures* data);
183 
184  private:
185 
186  void init();
187 
188  protected:
197 };
198 }
199 #endif
virtual CBinaryLabels * apply_binary(CFeatures *data=NULL)
virtual bool train(CFeatures *data=NULL)
virtual SGVector< float64_t > apply_get_outputs(CFeatures *data)
Real Labels are real-valued labels.
virtual CRegressionLabels * apply_regression(CFeatures *data=NULL)
virtual void set_w(const SGVector< float64_t > src_w)
virtual CDotFeatures * get_features()
Features that support dot products among other operations.
Definition: DotFeatures.h:44
A generic learning machine interface.
Definition: Machine.h:143
virtual float64_t apply_one(int32_t vec_idx)
double float64_t
Definition: common.h:50
virtual const char * get_name() const
virtual bool get_compute_bias()
SGVector< float64_t > w
virtual void set_features(CDotFeatures *feat)
Class LinearMachine is a generic interface for all kinds of linear machines like classifiers.
Definition: LinearMachine.h:63
virtual void store_model_features()
virtual SGVector< float64_t > get_w() const
virtual void set_compute_bias(bool compute_bias)
CDotFeatures * features
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
The class Features is the base class of all feature objects.
Definition: Features.h:68
virtual float64_t get_bias()
Binary Labels for binary classification.
Definition: BinaryLabels.h:37
virtual void set_bias(float64_t b)
void compute_bias(CFeatures *data)

SHOGUN Machine Learning Toolbox - Documentation