-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsvm_wrapper.h
More file actions
58 lines (43 loc) · 1.74 KB
/
svm_wrapper.h
File metadata and controls
58 lines (43 loc) · 1.74 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef SVM_WRAPPER_H
#define SVM_WRAPPER_H
// LIBSVM との仲立ちを行う
// 達成する事
// 1. svm_train ()を呼び出すための事前設定
// 事前設定(param, problem)には、画像ファイルの情報が必要
// 2. svm_train ()を呼ぶ
#include "svm.h"
#include <vector>
#include <cstdlib>
class SimpleMethod;
struct SvmWrapper {
// LibSVM に必要なパラメータインスタンス
svm_parameter param;
svm_problem problem;
// param の初期化を行う
void init_svm_parameter();
// problem の初期化を行う(legacy code)
void init_svm_problem();
void init_svm_problem_positive_default(int& idx);
void init_svm_problem_negative_default(int& idx);
void init_svm_problem_dynamic(const char* name);
// データベースと比較し、ランキングをcui表示する
void eval_vector(const std::vector<double>& w, const double rho);
// libSVM の API を利用して、線形SVMの情報を得る
// TODO: 関数名変更
void get_model();
// get_model() と異なり、重みベクトルが関数の返り値であり、
// また eval_vector() が内部で呼び出されないため、ランキングとも比較されない
// get_model() または get_weight_vector() のどちらか一方が一度が呼び出されると
// param, problem メンバは破棄される
std::vector<double> get_weight_vector();
// problemを破棄する
void dispose_svm();
// 画像の特徴量をguiで表現する
void for_presentation(const std::vector<double>& w);
// コンストラクタ
// 各引数はSvmWrapperの初期化方法を表現している
SvmWrapper(int argc = 1, char**argv = NULL, bool auto_initialize = true);
~SvmWrapper();
void run();
};
#endif // SVM_WRAPPER_H