00001 // -*- C++ -*- 00002 #ifndef __LEMGA_AGGREGATING_H__ 00003 #define __LEMGA_AGGREGATING_H__ 00004 00011 #include <vector> 00012 #include "learnmodel.h" 00013 00014 namespace lemga { 00015 00040 class Aggregating : public LearnModel { 00041 protected: 00042 pcLearnModel lm_base; 00043 std::vector<pLearnModel> lm; 00044 UINT n_in_agg; 00045 UINT max_n_model; 00046 00047 public: 00048 Aggregating () : LearnModel(), n_in_agg(0), max_n_model(0) {} 00049 Aggregating (const Aggregating&); 00050 const Aggregating& operator= (const Aggregating&); 00051 00052 virtual Aggregating* create () const = 0; 00053 virtual Aggregating* clone () const = 0; 00054 00056 void set_base_model (const LearnModel&); 00057 const LearnModel& base_model () const { return *lm_base; } 00059 00060 void set_max_models (UINT max) { max_n_model = max; } 00061 00063 00064 UINT size () const { return lm.size(); } 00065 bool empty () const { return lm.empty(); } 00066 const LearnModel& model (UINT n) const { return *lm[n]; } 00067 const LearnModel& operator[] (UINT n) const { return *lm[n]; } 00069 00070 virtual bool set_aggregation_size (UINT); 00071 UINT aggregation_size () const { return n_in_agg; } 00072 virtual void set_train_data (const pDataSet&, const pDataWgt& = 0); 00073 virtual void reset (); 00074 00075 protected: 00076 virtual bool serialize (std::ostream&, ver_list&) const; 00077 virtual bool unserialize (std::istream&, ver_list&, const id_t& = NIL_ID); 00078 }; 00079 00080 } // namespace lemga 00081 00082 #ifdef __AGGREGATING_H__ 00083 #warning "This header file may conflict with another `aggregating.h' file." 00084 #endif 00085 #define __AGGREGATING_H__ 00086 #endif