SHOGUN  v2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
18 
19 namespace shogun
20 {
21 
31 {
32 public:
34  CShareBoost();
35 
37  CShareBoost(CDenseFeatures<float64_t> *features, CMulticlassLabels *labs, int32_t num_nonzero_feas);
38 
40  virtual ~CShareBoost() {}
41 
43  virtual const char* get_name() const { return "ShareBoost"; }
44 
46  void set_num_nonzero_feas(int32_t n) { m_nonzero_feas = n; }
47 
49  int32_t get_num_nonzero_feas() const { return m_nonzero_feas; }
50 
52  void set_features(CFeatures *f);
53 
56 
57  friend class ShareBoostOptimizer;
58 protected:
59 
61  virtual bool train_machine(CFeatures* data = NULL);
62 
63 private:
64  void init_sb_params();
65 
66  void compute_rho();
67  int32_t choose_feature();
68  void optimize_coefficients();
69  void compute_pred();
70  void compute_pred(const float64_t *W);
71 
72  int32_t m_nonzero_feas;
73  SGVector<int32_t> m_activeset;
74 
75  SGMatrix<float64_t> m_fea;
76  SGMatrix<float64_t> m_rho;
77  SGVector<float64_t> m_rho_norm;
78  SGMatrix<float64_t> m_pred;
79 };
80 
81 } /* shogun */
82 
83 #endif /* end of include guard: SHAREBOOST_H__ */
84 

SHOGUN Machine Learning Toolbox - Documentation