LPM.h

Go to the documentation of this file.
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) 2007-2009 Soeren Sonnenburg
00008  * Copyright (C) 2007-2009 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef _LPM_H___
00012 #define _LPM_H___
00013 
00014 #include "lib/config.h"
00015 #ifdef USE_CPLEX
00016 
00017 #include <stdio.h>
00018 #include "lib/common.h"
00019 #include "features/Features.h"
00020 #include "classifier/LinearClassifier.h"
00021 
00022 namespace shogun
00023 {
00043 class CLPM : public CLinearClassifier
00044 {
00045     public:
00046         CLPM();
00047         virtual ~CLPM();
00048 
00057         virtual bool train(CFeatures* data=NULL);
00058 
00059         inline virtual EClassifierType get_classifier_type()
00060         {
00061             return CT_LPM;
00062         }
00063 
00068         virtual inline void set_features(CDotFeatures* feat)
00069         {
00070             if (feat->get_feature_class() != C_SPARSE ||
00071                 feat->get_feature_type() != F_DREAL)
00072                 SG_ERROR("LPM requires SPARSE REAL valued features\n");
00073 
00074             CLinearClassifier::set_features(feat);
00075         }
00076 
00083         inline void set_C(float64_t c_neg, float64_t c_pos) { C1=c_neg; C2=c_pos; }
00084 
00085         inline float64_t get_C1() { return C1; }
00086         inline float64_t get_C2() { return C2; }
00087 
00088         inline void set_bias_enabled(bool enable_bias) { use_bias=enable_bias; }
00089         inline bool get_bias_enabled() { return use_bias; }
00090 
00091         inline void set_epsilon(float64_t eps) { epsilon=eps; }
00092         inline float64_t get_epsilon() { return epsilon; }
00093 
00095         inline virtual const char* get_name() const { return "LPM"; }
00096 
00097     protected:
00098         float64_t C1;
00099         float64_t C2;
00100         bool use_bias;
00101         float64_t epsilon;
00102 };
00103 }
00104 #endif //USE_CPLEX
00105 #endif //_LPM_H___
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation