ThunderSVM
ThunderSVM: An Open-Source SVM Library on GPUs and CPUs
Public Member Functions | Protected Member Functions | List of all members
SVC Class Reference

Support Vector Machine for classification. More...

#include <svc.h>

Inheritance diagram for SVC:
SvmModel NuSVC

Public Member Functions

void train (const DataSet &dataset, SvmParam param) override
 
vector< float_type > predict (const DataSet::node2d &instances, int batch_size) override
 
- Public Member Functions inherited from SvmModel
void predict_dec_values (const DataSet::node2d &instances, SyncArray< float_type > &dec_values, int batch_size) const
 
virtual vector< float_type > cross_validation (DataSet dataset, SvmParam param, int n_fold)
 
virtual void save_to_file (string path)
 
virtual void load_from_file (string path)
 

Protected Member Functions

virtual void train_binary (const DataSet &dataset, int i, int j, SyncArray< float_type > &alpha, float_type &rho)
 
void model_setup (const DataSet &dataset, SvmParam &param) override
 

Additional Inherited Members

- Protected Attributes inherited from SvmModel
SvmParam param
 
SyncArray< float_type > coef
 
DataSet::node2d sv
 
SyncArray< int > n_sv
 the number of support vectors for each class
 
int n_total_sv
 the number of support vectors for all classes
 
SyncArray< float_type > rho
 the bias term for each binary model
 
int n_classes = 2
 the number of classes
 
size_t n_binary_models
 the number of binary models, equal to \(k(k-1)/2\), where \(k\) is the number of classes
 
vector< float_type > probA
 be used to predict probability for each binary model
 
vector< float_type > probB
 be used to predict probability for each binary model
 
vector< int > label
 only for SVC, maps logical label (0,1,2,...) to real label in dataset (maybe 2,4,5,...)
 

Detailed Description

Support Vector Machine for classification.

Member Function Documentation

◆ model_setup()

void SVC::model_setup ( const DataSet dataset,
SvmParam param 
)
overrideprotectedvirtual

called at the begining of train(), do initialization

Parameters
dataset
param

Reimplemented from SvmModel.

◆ predict()

vector< float_type > SVC::predict ( const DataSet::node2d &  instances,
int  batch_size 
)
overridevirtual

predict label given instances.

Parameters
instancesinstances used
batch_sizethe number of instances to predict parallel, higher value needs more memory
Returns
label (SVC, NuSVC), real number (SVR, NuSVR), {-1,+1} (OneClassSVC)

Reimplemented from SvmModel.

◆ train()

void SVC::train ( const DataSet dataset,
SvmParam  param 
)
overridevirtual

train model given dataset and param.

Parameters
datasettraining dataset
paramparam for training

Implements SvmModel.

◆ train_binary()

void SVC::train_binary ( const DataSet dataset,
int  i,
int  j,
SyncArray< float_type > &  alpha,
float_type &  rho 
)
protectedvirtual

train a binary SVC model \(SVM_{i,j}\) for class i and class j.

Parameters
[in]datasetoriginal dataset
[in]i
[in]j
[out]alphaoptimization variables \(\boldsymbol{\alpha}\) in dual problem, should be initialized with the same size of the number of instances in this binary problem
[out]rhobias term \(b\) in dual problem

Reimplemented in NuSVC.


The documentation for this class was generated from the following files: