SHOGUN
v3.2.0
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2013 Viktor Gal 00008 * Copyright (C) 2013 Viktor Gal 00009 */ 00010 00011 #ifndef _WEIGHTED_MAJORITY_VOTE_H_ 00012 #define _WEIGHTED_MAJORITY_VOTE_H_ 00013 00014 #include <shogun/ensemble/CombinationRule.h> 00015 #include <shogun/lib/SGVector.h> 00016 00017 namespace shogun 00018 { 00032 class CWeightedMajorityVote : public CCombinationRule 00033 { 00034 public: 00038 CWeightedMajorityVote(); 00039 00046 CWeightedMajorityVote(SGVector<float64_t>& weights); 00047 00048 virtual ~CWeightedMajorityVote(); 00049 00058 virtual SGVector<float64_t> combine(const SGMatrix<float64_t>& ensemble_result) const; 00059 00067 virtual float64_t combine(const SGVector<float64_t>& ensemble_result) const; 00068 00074 void set_weights(SGVector<float64_t>& w); 00075 00081 SGVector<float64_t> get_weights() const; 00082 00084 virtual const char* get_name() const { return "WeightedMajorityVote"; } 00085 00086 protected: 00093 virtual float64_t weighted_combine(const SGVector<float64_t>& ensemble_result) const; 00094 00096 mutable SGVector<float64_t> m_weights; 00097 00098 private: 00099 void init(); 00100 void register_parameters(); 00101 }; 00102 } 00103 00104 #endif /* _WEIGHTED_MAJORITY_VOTE_H_ */