SHOGUN  5.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
ShareBoost.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) 2012 Chiyuan Zhang
8  * Copyright (C) 2012 Chiyuan Zhang
9  */
10 
11 #ifndef SHAREBOOST_H__
12 #define SHAREBOOST_H__
13 
14 #include <shogun/lib/config.h>
15 
20 
21 namespace shogun
22 {
23 
33 {
34 public:
36  CShareBoost();
37 
39  CShareBoost(CDenseFeatures<float64_t> *features, CMulticlassLabels *labs, int32_t num_nonzero_feas);
40 
42  virtual ~CShareBoost() {}
43 
45  virtual const char* get_name() const { return "ShareBoost"; }
46 
48  void set_num_nonzero_feas(int32_t n) { m_nonzero_feas = n; }
49 
51  int32_t get_num_nonzero_feas() const { return m_nonzero_feas; }
52 
54  void set_features(CFeatures *f);
55 
58 
59  friend class ShareBoostOptimizer;
60 protected:
61 
63  virtual bool train_machine(CFeatures* data = NULL);
64 
65 private:
66  void init_sb_params();
67 
68  void compute_rho();
69  int32_t choose_feature();
70  void optimize_coefficients();
71  void compute_pred();
72  void compute_pred(const float64_t *W);
73 
74  int32_t m_nonzero_feas;
75  SGVector<int32_t> m_activeset;
76 
77  SGMatrix<float64_t> m_fea;
78  SGMatrix<float64_t> m_rho;
79  SGVector<float64_t> m_rho_norm;
80  SGMatrix<float64_t> m_pred;
81 };
82 
83 } /* shogun */
84 
85 #endif /* end of include guard: SHAREBOOST_H__ */
86 
SGVector< int32_t > get_activeset()
Definition: ShareBoost.cpp:39
int32_t get_num_nonzero_feas() const
Definition: ShareBoost.h:51
void set_features(CFeatures *f)
Definition: ShareBoost.cpp:199
Multiclass Labels for multi-class classification.
generic linear multiclass machine
virtual const char * get_name() const
Definition: ShareBoost.h:45
double float64_t
Definition: common.h:50
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual bool train_machine(CFeatures *data=NULL)
Definition: ShareBoost.cpp:44
The class Features is the base class of all feature objects.
Definition: Features.h:68
virtual ~CShareBoost()
Definition: ShareBoost.h:42
void set_num_nonzero_feas(int32_t n)
Definition: ShareBoost.h:48

SHOGUN Machine Learning Toolbox - Documentation