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 #include <shogun/multiclass/MulticlassStrategy.h> 00012 00013 namespace shogun 00014 { 00015 00022 class CMulticlassOneVsOneStrategy: public CMulticlassStrategy 00023 { 00024 public: 00026 CMulticlassOneVsOneStrategy(); 00027 00029 virtual ~CMulticlassOneVsOneStrategy() {} 00030 00032 virtual void train_start(CMulticlassLabels *orig_labels, CBinaryLabels *train_labels); 00033 00035 virtual bool train_has_more(); 00036 00040 virtual SGVector<int32_t> train_prepare_next(); 00041 00045 virtual int32_t decide_label(SGVector<float64_t> outputs); 00046 00049 virtual int32_t get_num_machines() 00050 { 00051 return m_num_classes*(m_num_classes-1)/2; 00052 } 00053 00055 virtual const char* get_name() const 00056 { 00057 return "MulticlassOneVsOneStrategy"; 00058 }; 00059 00060 protected: 00061 int32_t m_num_machines; 00062 int32_t m_train_pair_idx_1; 00063 int32_t m_train_pair_idx_2; 00064 }; 00065 00066 } // namespace shogun