| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef _COSTFACTORYSVM_H_ |
| 22 |
#define _COSTFACTORYSVM_H_ |
| 23 |
|
| 24 |
|
| 25 |
#include <cmath> |
| 26 |
#include <vector> |
| 27 |
#include <map> |
| 28 |
#include "base/Vector2d.h" |
| 29 |
#include "CostFactory.h" |
| 30 |
|
| 31 |
namespace svm{ |
| 32 |
enum SVM_TYPE {C_SVC=0, nu_SVC=1,one_class=2, epsilon_SVR=3, nu_SVR=4}; |
| 33 |
enum KERNEL_TYPE {linear=0,polynomial=1,radial=2,sigmoid=3}; |
| 34 |
} |
| 35 |
|
| 36 |
class CostFactorySVM : public CostFactory |
| 37 |
{ |
| 38 |
public: |
| 39 |
CostFactorySVM(); |
| 40 |
CostFactorySVM(std::string svm_type, std::string kernel_type, unsigned short kernel_degree, float gamma, float coef0, float ccost, float nu, float epsilon_loss, int cache, float epsilon_tol, bool shrinking, bool prob_est, unsigned short cv, short verbose); |
| 41 |
~CostFactorySVM(); |
| 42 |
double getCost(const std::vector<Vector2d<float> > &trainingFeatures); |
| 43 |
|
| 44 |
private: |
| 45 |
std::string m_svm_type; |
| 46 |
std::string m_kernel_type; |
| 47 |
unsigned short m_kernel_degree; |
| 48 |
float m_gamma; |
| 49 |
float m_coef0; |
| 50 |
float m_ccost; |
| 51 |
float m_nu; |
| 52 |
float m_epsilon_loss; |
| 53 |
int m_cache; |
| 54 |
float m_epsilon_tol; |
| 55 |
bool m_shrinking; |
| 56 |
bool m_prob_est; |
| 57 |
}; |
| 58 |
#endif |