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) 2011 Sergey Lisitsyn 00008 * Copyright (C) 2011 Sergey Lisitsyn 00009 */ 00010 00011 #ifndef CONJUGATEINDEX_H_ 00012 #define CONJUGATEINDEX_H_ 00013 #ifdef HAVE_LAPACK 00014 #include <shogun/machine/Machine.h> 00015 #include <shogun/mathematics/Math.h> 00016 #include <shogun/features/DenseFeatures.h> 00017 00018 namespace shogun 00019 { 00020 00021 class CLabels; 00022 class CDotFeatures; 00023 class CFeatures; 00024 00034 class CConjugateIndex : public CMachine 00035 { 00036 00037 public: 00038 MACHINE_PROBLEM_TYPE(PT_MULTICLASS) 00039 00040 00043 CConjugateIndex(); 00044 00049 CConjugateIndex(CFeatures* train_features, CLabels* train_labels); 00050 00054 virtual ~CConjugateIndex(); 00055 00059 virtual void set_features(CFeatures* features); 00060 00064 virtual CDenseFeatures<float64_t>* get_features(); 00065 00070 virtual CMulticlassLabels* apply_multiclass(CFeatures* data=NULL); 00071 00076 virtual float64_t apply_one(int32_t idx); 00077 00081 virtual const char* get_name() const { return "ConjugateIndex"; }; 00082 00086 virtual EMachineType get_classifier_type() { return CT_CONJUGATEINDEX; }; 00087 00088 protected: 00089 00094 virtual bool train_machine(CFeatures* data=NULL); 00095 00097 void clean_classes(); 00098 00105 float64_t conjugate_index(SGVector<float64_t> feature_vector, int32_t label); 00106 00107 protected: 00108 00110 int32_t m_num_classes; 00111 00113 SGVector<float64_t> m_feature_vector; 00114 00116 SGMatrix<float64_t>* m_classes; 00117 00119 CDenseFeatures<float64_t>* m_features; 00120 00121 }; 00122 00123 } 00124 #endif /* HAVE_LAPACK */ 00125 #endif /* CONJUGATEINDEX_H_ */