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) 2012 Chiyuan Zhang 00008 * Copyright (C) 2012 Chiyuan Zhang 00009 */ 00010 00011 #ifndef ECOCSTRATEGY_H__ 00012 #define ECOCSTRATEGY_H__ 00013 00014 #include <shogun/multiclass/MulticlassStrategy.h> 00015 #include <shogun/multiclass/ecoc/ECOCEncoder.h> 00016 #include <shogun/multiclass/ecoc/ECOCDecoder.h> 00017 00018 namespace shogun 00019 { 00020 00022 class CECOCStrategy: public CMulticlassStrategy 00023 { 00024 public: 00026 CECOCStrategy(); 00027 00029 CECOCStrategy(CECOCEncoder *encoder, CECOCDecoder *decoder); 00030 00032 virtual ~CECOCStrategy(); 00033 00035 virtual const char* get_name() const 00036 { 00037 return "ECOCStrategy"; 00038 } 00039 00041 virtual void train_start(CMulticlassLabels *orig_labels, CBinaryLabels *train_labels); 00042 00044 virtual bool train_has_more(); 00045 00049 virtual SGVector<int32_t> train_prepare_next(); 00050 00054 virtual int32_t decide_label(SGVector<float64_t> outputs); 00055 00058 virtual int32_t get_num_machines(); 00059 00060 protected: 00062 CECOCEncoder *m_encoder; 00064 CECOCDecoder *m_decoder; 00065 00067 SGMatrix<int32_t> m_codebook; 00068 00069 private: 00071 void init(); 00072 }; 00073 00074 00075 } 00076 00077 #endif /* end of include guard: ECOCSTRATEGY_H__ */