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 MULTICLASSONEVSRESTSTRATEGY_H__ 00012 #define MULTICLASSONEVSRESTSTRATEGY_H__ 00013 00014 #include <shogun/multiclass/MulticlassStrategy.h> 00015 00016 namespace shogun 00017 { 00018 00025 class CMulticlassOneVsRestStrategy: public CMulticlassStrategy 00026 { 00027 public: 00029 CMulticlassOneVsRestStrategy(); 00030 00032 virtual ~CMulticlassOneVsRestStrategy() {} 00033 00035 virtual void train_start(CMulticlassLabels *orig_labels, CBinaryLabels *train_labels) 00036 { 00037 CMulticlassStrategy::train_start(orig_labels, train_labels); 00038 } 00039 00041 virtual bool train_has_more() 00042 { 00043 return m_train_iter < m_num_classes; 00044 } 00045 00049 virtual SGVector<int32_t> train_prepare_next(); 00050 00054 virtual int32_t decide_label(SGVector<float64_t> outputs); 00055 00060 virtual SGVector<index_t> decide_label_multiple_output(SGVector<float64_t> outputs, int32_t n_outputs); 00061 00064 virtual int32_t get_num_machines() 00065 { 00066 return m_num_classes; 00067 } 00068 00070 virtual const char* get_name() const 00071 { 00072 return "MulticlassOneVsRestStrategy"; 00073 }; 00074 00075 }; 00076 00077 } // namespace shogun 00078 00079 #endif /* end of include guard: MULTICLASSONEVSRESTSTRATEGY_H__ */ 00080