adaboost_ecoc.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef __LEMGA_MULTICLASS_ADABOOST_ECOC_H__
00003 #define __LEMGA_MULTICLASS_ADABOOST_ECOC_H__
00004 
00011 #include "multiclass_ecoc.h"
00012 #include "shared_ptr.h"
00013 
00014 namespace lemga {
00015 
00016 typedef std::vector<DataWgt> JointWgt;
00017 typedef const_shared_ptr<JointWgt> pJointWgt;
00018 
00021 class AdaBoost_ECOC : public MultiClass_ECOC {
00022 public:
00023     enum PARTITION_METHOD {
00024         RANDOM_HALF,
00025         MAX_CUT,
00026         MAX_CUT_GREEDY
00027     };
00028 
00029 protected:
00030     PARTITION_METHOD par_method;
00031 
00032 public:
00033     AdaBoost_ECOC () : MultiClass_ECOC(), par_method(MAX_CUT_GREEDY) {}
00034     explicit AdaBoost_ECOC (std::istream& is) { is >> *this; }
00035 
00036     virtual const id_t& id () const;
00037     virtual AdaBoost_ECOC* create () const { return new AdaBoost_ECOC(); }
00038     virtual AdaBoost_ECOC* clone () const {
00039         return new AdaBoost_ECOC(*this); }
00040 
00041     void set_partition_method (PARTITION_METHOD m) { par_method = m; }
00042 
00043 protected:
00044     // only valid during training
00045     JointWgt joint_wgt;
00046     std::vector<bool> cur_err;
00047     pDataWgt cur_smpwgt;
00048     pDataWgt smpwgt_with_partition (const ECOC_VECTOR&);
00049 
00050     virtual void reset_training ();
00051     virtual bool ECOC_partition (UINT, ECOC_VECTOR&);
00052     virtual pLearnModel train_with_partition (ECOC_VECTOR&);
00053     virtual REAL assign_weight (const ECOC_VECTOR&, const LearnModel&);
00054     virtual void update_training (const ECOC_VECTOR&);
00055 
00056     std::vector<std::vector<REAL> > confusion_matrix () const;
00057     ECOC_VECTOR max_cut (UINT) const;
00058     ECOC_VECTOR max_cut_greedy (UINT) const;
00059     ECOC_VECTOR random_half (UINT) const;
00060 };
00061 
00062 } // namespace lemga
00063 
00064 #ifdef  __ADABOOST_ECOC_H__
00065 #warning "This header file may conflict with another `adaboost_ecoc.h' file."
00066 #endif
00067 #define __ADABOOST_ECOC_H__
00068 #endif

Generated on Mon Jan 9 23:43:23 2006 for LEMGA by  doxygen 1.4.6