ThunderSVM
ThunderSVM: An Open-Source SVM Library on GPUs and CPUs
svc.h
1 //
2 // Created by jiashuai on 17-9-21.
3 //
4 
5 #ifndef THUNDERSVM_SVC_H
6 #define THUNDERSVM_SVC_H
7 
8 #include <map>
9 #include <thundersvm/kernelmatrix.h>
10 #include "svmmodel.h"
11 
12 using std::map;
13 
17 class SVC : public SvmModel {
18 public:
19 
20  void train(const DataSet &dataset, SvmParam param) override;
21 
22  vector<float_type> predict(const DataSet::node2d &instances, int batch_size) override;
23 
24 protected:
35  virtual void train_binary(const DataSet &dataset, int i, int j, SyncArray<float_type> &alpha, float_type &rho);
36 
37  void model_setup(const DataSet &dataset, SvmParam &param) override;
38 
39 private:
40 
48  vector<float_type> predict_label(const SyncArray<float_type> &dec_values, int n_instances) const;
49 
56  void probability_train(const DataSet &dataset);
57 
63  void multiclass_probability(const vector<vector<float_type>> &r, vector<float_type> &p) const;
64 
68  vector<float_type> c_weight;
69 
70 
71 };
72 
73 #endif //THUNDERSVM_SVC_H
void train(const DataSet &dataset, SvmParam param) override
Definition: svc.cpp:40
void model_setup(const DataSet &dataset, SvmParam &param) override
Definition: svc.cpp:16
vector< float_type > predict(const DataSet::node2d &instances, int batch_size) override
Definition: svc.cpp:148
virtual void train_binary(const DataSet &dataset, int i, int j, SyncArray< float_type > &alpha, float_type &rho)
Definition: svc.cpp:117
Dataset reader.
Definition: dataset.h:14
params for ThunderSVM
Definition: svmparam.h:13
Abstract class for different SVM models.
Definition: svmmodel.h:18
SyncArray< float_type > rho
the bias term for each binary model
Definition: svmmodel.h:104
Support Vector Machine for classification.
Definition: svc.h:17