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) 1999-2008 Soeren Sonnenburg 00008 * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 00011 #include "classifier/Classifier.h" 00012 00013 CClassifier::CClassifier() : CSGObject(), max_train_time(0), labels(NULL) 00014 { 00015 } 00016 00017 CClassifier::~CClassifier() 00018 { 00019 SG_UNREF(labels); 00020 } 00021 00022 CLabels* CClassifier::classify(CLabels* output) 00023 { 00024 if (labels) 00025 { 00026 int32_t num=labels->get_num_labels(); 00027 ASSERT(num>0); 00028 00029 if (!output) 00030 output=new CLabels(num); 00031 00032 for (int32_t i=0; i<num; i++) 00033 output->set_label(i, classify_example(i)); 00034 00035 return output; 00036 } 00037 00038 return NULL; 00039 }