-
Notifications
You must be signed in to change notification settings - Fork 2
/
SVMUtil.h
46 lines (30 loc) · 851 Bytes
/
SVMUtil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
struct svm_problem;
struct svm_node;
struct svm_parameter;
struct svm_model;
class CParameterSearch;
#include <string>
#define Malloc(type,n) (type *)malloc((n)*sizeof(type))
class SVMUtil
{
public:
SVMUtil();
~SVMUtil();
svm_problem* ParseTrainingFile(std::string strFilename);
bool ParameterSearch( svm_parameter* pSvmParam, std::string strFilename);
bool ScaleNode(svm_node*);
bool CrossValidate(int nFolds, svm_parameter*);
bool Load(std::string);
bool Save(std::string);
svm_model* m_pModel;
private:
bool ScaleTrainingData();
bool DetermineScaleFactors();
bool SaveSearch(const CParameterSearch* p_Search);
void SaveScaleFactors(std::string);
bool LoadScaleFactors(std::string);
svm_problem* m_pProblem;
double* m_pScaleFactors;
int m_nParams;
};