SHOGUN
v2.0.0
|
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 #include <shogun/mathematics/Math.h> 00013 00014 using namespace shogun; 00015 00016 00017 CMulticlassStrategy::CMulticlassStrategy() 00018 : m_rejection_strategy(NULL), m_train_labels(NULL), m_orig_labels(NULL), m_train_iter(0) 00019 { 00020 SG_ADD((CSGObject**)&m_rejection_strategy, "rejection_strategy", "Strategy of rejection", MS_NOT_AVAILABLE); 00021 SG_ADD(&m_num_classes, "num_classes", "Number of classes", MS_NOT_AVAILABLE); 00022 } 00023 00024 void CMulticlassStrategy::train_start(CMulticlassLabels *orig_labels, CBinaryLabels *train_labels) 00025 { 00026 if (m_train_labels != NULL) 00027 SG_ERROR("Stop the previous training task before starting a new one!"); 00028 SG_REF(train_labels); 00029 m_train_labels=train_labels; 00030 SG_REF(orig_labels); 00031 m_orig_labels=orig_labels; 00032 m_train_iter=0; 00033 } 00034 00035 SGVector<int32_t> CMulticlassStrategy::train_prepare_next() 00036 { 00037 m_train_iter++; 00038 return SGVector<int32_t>(); 00039 } 00040 00041 void CMulticlassStrategy::train_stop() 00042 { 00043 SG_UNREF(m_train_labels); 00044 SG_UNREF(m_orig_labels); 00045 m_train_labels = NULL; 00046 m_orig_labels = NULL; 00047 }