opencv: CvSVM Class Reference

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

# CvSVM Class Reference

`#include <ml.hpp>`

Inheritance diagram for CvSVM:

List of all members.

## Public Types
enum | { C_SVC = 100, NU_SVC = 101, ONE_CLASS = 102, EPS_SVR = 103, NU_SVR = 104 }
enum | { LINEAR = 0, POLY = 1, RBF = 2, SIGMOID = 3 }
enum | { C = 0, GAMMA = 1, P = 2, NU = 3, COEF = 4, DEGREE = 5 }
## Public Member Functions
virtual CV_WRAP void | clear ()
CV_WRAP | CvSVM ()
| CvSVM (const CvMat *trainData, const CvMat *responses, const CvMat *varIdx=0, const CvMat *sampleIdx=0, CvSVMParams params=CvSVMParams())
CV_WRAP | CvSVM (const cv::Mat &trainData, const cv::Mat &responses, const cv::Mat &varIdx=cv::Mat(), const cv::Mat &sampleIdx=cv::Mat(), CvSVMParams params=CvSVMParams())
virtual CvSVMParams | get_params () const
virtual const float * | get_support_vector (int i) const
virtual CV_WRAP int | get_support_vector_count () const
CV_WRAP int | get_var_count () const
virtual CV_WRAP float | predict (const cv::Mat &sample, bool returnDFVal=false) const
virtual float | predict (const CvMat *sample, bool returnDFVal=false) const
virtual void | read (CvFileStorage *storage, CvFileNode *node)
virtual bool | train (const CvMat *trainData, const CvMat *responses, const CvMat *varIdx=0, const CvMat *sampleIdx=0, CvSVMParams params=CvSVMParams())
virtual CV_WRAP bool | train (const cv::Mat &trainData, const cv::Mat &responses, const cv::Mat &varIdx=cv::Mat(), const cv::Mat &sampleIdx=cv::Mat(), CvSVMParams params=CvSVMParams())
virtual CV_WRAP bool | train_auto (const cv::Mat &trainData, const cv::Mat &responses, const cv::Mat &varIdx, const cv::Mat &sampleIdx, CvSVMParams params, int k_fold=10, CvParamGrid Cgrid=CvSVM::get_default_grid(CvSVM::C), CvParamGrid gammaGrid=CvSVM::get_default_grid(CvSVM::GAMMA), CvParamGrid pGrid=CvSVM::get_default_grid(CvSVM::P), CvParamGrid nuGrid=CvSVM::get_default_grid(CvSVM::NU), CvParamGrid coeffGrid=CvSVM::get_default_grid(CvSVM::COEF), CvParamGrid degreeGrid=CvSVM::get_default_grid(CvSVM::DEGREE), bool balanced=false)
virtual bool | train_auto (const CvMat *trainData, const CvMat *responses, const CvMat *varIdx, const CvMat *sampleIdx, CvSVMParams params, int kfold=10, CvParamGrid Cgrid=get_default_grid(CvSVM::C), CvParamGrid gammaGrid=get_default_grid(CvSVM::GAMMA), CvParamGrid pGrid=get_default_grid(CvSVM::P), CvParamGrid nuGrid=get_default_grid(CvSVM::NU), CvParamGrid coeffGrid=get_default_grid(CvSVM::COEF), CvParamGrid degreeGrid=get_default_grid(CvSVM::DEGREE), bool balanced=false)
virtual void | write (CvFileStorage *storage, const char *name) const
virtual | ~CvSVM ()
## Static Public Member Functions
static CvParamGrid | get_default_grid (int param_id)
## Protected Member Functions
virtual void | create_kernel ()
virtual void | create_solver ()
virtual bool | do_train (int svm_type, int sample_count, int var_count, const float **samples, const CvMat *responses, CvMemStorage *_storage, double *alpha)
virtual float | predict (const float *row_sample, int row_len, bool returnDFVal=false) const
virtual void | read_params (CvFileStorage *fs, CvFileNode *node)
virtual bool | set_params (const CvSVMParams &params)
virtual bool | train1 (int sample_count, int var_count, const float **samples, const void *responses, double Cp, double Cn, CvMemStorage *_storage, double *alpha, double &rho)
virtual void | write_params (CvFileStorage *fs) const
## Protected Attributes
CvMat * | class_labels
CvMat * | class_weights
CvSVMDecisionFunc * | decision_func
CvSVMKernel * | kernel
CvSVMParams | params
CvSVMSolver * | solver
CvMemStorage * | storage
float ** | sv
int | sv_total
int | var_all
CvMat * | var_idx

## Member Enumeration Documentation

anonymous enum

Enumerator:

  C_SVC |
  NU_SVC |
  ONE_CLASS |
  EPS_SVR |
  NU_SVR |

anonymous enum

Enumerator:

  LINEAR |
  POLY |
  RBF |
  SIGMOID |

anonymous enum

Enumerator:

  C |
  GAMMA |
  P |
  NU |
  COEF |
  DEGREE |

## Constructor & Destructor Documentation

CV_WRAP CvSVM::CvSVM | ( | ) |

virtual CvSVM::~CvSVM | ( | ) | `[virtual]`

CvSVM::CvSVM | ( | const CvMat * | trainData,
|  | const CvMat * | responses,
|  | const CvMat * | varIdx = `0`,
|  | const CvMat * | sampleIdx = `0`,
|  | CvSVMParams | params = `CvSVMParams()`
| ) |  |

CV_WRAP CvSVM::CvSVM | ( | const cv::Mat & | trainData,
|  | const cv::Mat & | responses,
|  | const cv::Mat & | varIdx = `cv::Mat()`,
|  | const cv::Mat & | sampleIdx = `cv::Mat()`,
|  | CvSVMParams | params = `CvSVMParams()`
| ) |  |

## Member Function Documentation

virtual CV_WRAP void CvSVM::clear | ( | ) | `[virtual]`

Reimplemented from CvStatModel.

virtual void CvSVM::create_kernel | ( | ) | `[protected, virtual]`

virtual void CvSVM::create_solver | ( | ) | `[protected, virtual]`

virtual bool CvSVM::do_train | ( | int | svm_type,
|  | int | sample_count,
|  | int | var_count,
|  | const float ** | samples,
|  | const CvMat * | responses,
|  | CvMemStorage * | _storage,
|  | double * | alpha
| ) |  | `[protected, virtual]`

static CvParamGrid CvSVM::get_default_grid | ( | int | param_id ) | `[static]`

virtual CvSVMParams CvSVM::get_params | ( | ) | const`[inline, virtual]`

virtual const float* CvSVM::get_support_vector | ( | int | i ) | const`[virtual]`

virtual CV_WRAP int CvSVM::get_support_vector_count | ( | ) | const`[virtual]`

CV_WRAP int CvSVM::get_var_count | ( | ) | const`[inline]`

virtual float CvSVM::predict | ( | const float * | row_sample,
|  | int | row_len,
|  | bool | returnDFVal = `false`
| ) |  | const`[protected, virtual]`

virtual float CvSVM::predict | ( | const CvMat * | sample,
|  | bool | returnDFVal = `false`
| ) |  | const`[virtual]`

virtual CV_WRAP float CvSVM::predict | ( | const cv::Mat & | sample,
|  | bool | returnDFVal = `false`
| ) |  | const`[virtual]`

virtual void CvSVM::read | ( | CvFileStorage * | storage,
|  | CvFileNode * | node
| ) |  | `[virtual]`

Reimplemented from CvStatModel.

virtual void CvSVM::read_params | ( | CvFileStorage * | fs,
|  | CvFileNode * | node
| ) |  | `[protected, virtual]`

virtual bool CvSVM::set_params | ( | const CvSVMParams & | params ) | `[protected, virtual]`

virtual CV_WRAP bool CvSVM::train | ( | const cv::Mat & | trainData,
|  | const cv::Mat & | responses,
|  | const cv::Mat & | varIdx = `cv::Mat()`,
|  | const cv::Mat & | sampleIdx = `cv::Mat()`,
|  | CvSVMParams | params = `CvSVMParams()`
| ) |  | `[virtual]`

virtual bool CvSVM::train | ( | const CvMat * | trainData,
|  | const CvMat * | responses,
|  | const CvMat * | varIdx = `0`,
|  | const CvMat * | sampleIdx = `0`,
|  | CvSVMParams | params = `CvSVMParams()`
| ) |  | `[virtual]`

virtual bool CvSVM::train1 | ( | int | sample_count,
|  | int | var_count,
|  | const float ** | samples,
|  | const void * | responses,
|  | double | Cp,
|  | double | Cn,
|  | CvMemStorage * | _storage,
|  | double * | alpha,
|  | double & | rho
| ) |  | `[protected, virtual]`

virtual CV_WRAP bool CvSVM::train_auto | ( | const cv::Mat & | trainData,
|  | const cv::Mat & | responses,
|  | const cv::Mat & | varIdx,
|  | const cv::Mat & | sampleIdx,
|  | CvSVMParams | params,
|  | int | k_fold = `10`,
|  | CvParamGrid | Cgrid = `CvSVM::get_default_grid(CvSVM::C)`,
|  | CvParamGrid | gammaGrid = `CvSVM::get_default_grid(CvSVM::GAMMA)`,
|  | CvParamGrid | pGrid = `CvSVM::get_default_grid(CvSVM::P)`,
|  | CvParamGrid | nuGrid = `CvSVM::get_default_grid(CvSVM::NU)`,
|  | CvParamGrid | coeffGrid = `CvSVM::get_default_grid(CvSVM::COEF)`,
|  | CvParamGrid | degreeGrid = `CvSVM::get_default_grid(CvSVM::DEGREE)`,
|  | bool | balanced = `false`
| ) |  | `[virtual]`

virtual bool CvSVM::train_auto | ( | const CvMat * | trainData,
|  | const CvMat * | responses,
|  | const CvMat * | varIdx,
|  | const CvMat * | sampleIdx,
|  | CvSVMParams | params,
|  | int | kfold = `10`,
|  | CvParamGrid | Cgrid = `get_default_grid(CvSVM::C)`,
|  | CvParamGrid | gammaGrid = `get_default_grid(CvSVM::GAMMA)`,
|  | CvParamGrid | pGrid = `get_default_grid(CvSVM::P)`,
|  | CvParamGrid | nuGrid = `get_default_grid(CvSVM::NU)`,
|  | CvParamGrid | coeffGrid = `get_default_grid(CvSVM::COEF)`,
|  | CvParamGrid | degreeGrid = `get_default_grid(CvSVM::DEGREE)`,
|  | bool | balanced = `false`
| ) |  | `[virtual]`

virtual void CvSVM::write | ( | CvFileStorage * | storage,
|  | const char * | name
| ) |  | const`[virtual]`

Reimplemented from CvStatModel.

virtual void CvSVM::write_params | ( | CvFileStorage * | fs ) | const`[protected, virtual]`

## Member Data Documentation

CvMat* CvSVM::class_labels`[protected]`

CvMat* CvSVM::class_weights`[protected]`

CvSVMDecisionFunc* CvSVM::decision_func`[protected]`

CvSVMKernel* CvSVM::kernel`[protected]`

CvSVMParams CvSVM::params`[protected]`

CvSVMSolver* CvSVM::solver`[protected]`

CvMemStorage* CvSVM::storage`[protected]`

float** CvSVM::sv`[protected]`

int CvSVM::sv_total`[protected]`

int CvSVM::var_all`[protected]`

CvMat* CvSVM::var_idx`[protected]`

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

- /usr/ports/pobj/OpenCV-2.2.0/OpenCV-2.2.0/modules/ml/include/opencv2/ml/ml.hpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines