openModeller
Version 1.4.0
|
00001 00027 #ifndef _SVM_ALGHH_ 00028 #define _SVM_ALGHH_ 00029 00030 #include <openmodeller/om.hh> 00031 00032 #include "svm.h" 00033 00034 /**************************************************/ 00035 /************* Support Vector Machines ************/ 00036 00040 class SvmAlgorithm : public AlgorithmImpl 00041 { 00042 public: 00043 00044 SvmAlgorithm(); 00045 00046 ~SvmAlgorithm(); 00047 00048 int needNormalization(); 00049 int initialize(); 00050 int iterate(); 00051 int done() const; 00052 00053 Scalar getValue( const Sample& x ) const; 00054 int getConvergence( Scalar * const val ) const; 00055 00056 protected: 00057 00058 void _getNode( svm_node * node, const Sample& sample ) const; 00059 00060 void _getConfiguration( ConfigurationPtr& ) const; 00061 00062 void _setConfiguration( const ConstConfigurationPtr& ); 00063 00064 bool _done; 00065 00066 int _num_layers; 00067 00068 svm_parameter _svm_parameter; 00069 00070 svm_problem _svm_problem; 00071 00072 svm_model * _svm_model; 00073 00074 // Index of presence class in SVM arrays. No need to serialize it since it is 00075 // detected at run time. -1 means "to be determined". 00076 int _presence_index; 00077 }; 00078 00079 00080 #endif 00081