OpenCV  2.4.13.7
Open Source Computer Vision
CvSVM Class Reference

#include <ml.hpp>

Inheritance diagram for CvSVM:
CvStatModel cv::ocl::CvSVM_OCL

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

 CvSVM ()
 
virtual ~CvSVM ()
 
 CvSVM (const CvMat *trainData, const CvMat *responses, const CvMat *varIdx=0, const CvMat *sampleIdx=0, CvSVMParams params=CvSVMParams())
 
virtual bool train (const CvMat *trainData, const CvMat *responses, const CvMat *varIdx=0, const CvMat *sampleIdx=0, CvSVMParams params=CvSVMParams())
 
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 float predict (const CvMat *sample, bool returnDFVal=false) const
 
virtual float predict (const CvMat *samples, CV_OUT CvMat *results) const
 
 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 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 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 float predict (const cv::Mat &sample, bool returnDFVal=false) const
 
void predict (cv::InputArray samples, cv::OutputArray results) const
 
virtual int get_support_vector_count () const
 
virtual const float * get_support_vector (int i) const
 
virtual CvSVMParams get_params () const
 
virtual void clear ()
 
virtual void write (CvFileStorage *storage, const char *name) const
 
virtual void read (CvFileStorage *storage, CvFileNode *node)
 
int get_var_count () const
 
- Public Member Functions inherited from CvStatModel
 CvStatModel ()
 
virtual ~CvStatModel ()
 
virtual void save (const char *filename, const char *name=0) const
 
virtual void load (const char *filename, const char *name=0)
 

Static Public Member Functions

static CvParamGrid get_default_grid (int param_id)
 

Protected Member Functions

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 bool do_train (int svm_type, int sample_count, int var_count, const float **samples, const CvMat *responses, CvMemStorage *_storage, double *alpha)
 
virtual void create_kernel ()
 
virtual void create_solver ()
 
virtual float predict (const float *row_sample, int row_len, bool returnDFVal=false) const
 
virtual void write_params (CvFileStorage *fs) const
 
virtual void read_params (CvFileStorage *fs, CvFileNode *node)
 
void optimize_linear_svm ()
 

Protected Attributes

CvSVMParams params
 
CvMatclass_labels
 
int var_all
 
float ** sv
 
int sv_total
 
CvMatvar_idx
 
CvMatclass_weights
 
CvSVMDecisionFuncdecision_func
 
CvMemStoragestorage
 
CvSVMSolversolver
 
CvSVMKernelkernel
 
- Protected Attributes inherited from CvStatModel
const char * default_model_name
 

Member Enumeration Documentation

§ anonymous enum

anonymous enum
Enumerator
C_SVC 
NU_SVC 
ONE_CLASS 
EPS_SVR 
NU_SVR 

§ anonymous enum

anonymous enum
Enumerator
LINEAR 
POLY 
RBF 
SIGMOID 

§ anonymous enum

anonymous enum
Enumerator
GAMMA 
NU 
COEF 
DEGREE 

Constructor & Destructor Documentation

§ CvSVM() [1/3]

CvSVM::CvSVM ( )

§ ~CvSVM()

virtual CvSVM::~CvSVM ( )
virtual

§ CvSVM() [2/3]

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

§ CvSVM() [3/3]

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

§ clear()

virtual void CvSVM::clear ( )
virtual

Reimplemented from CvStatModel.

§ create_kernel()

virtual void CvSVM::create_kernel ( )
protectedvirtual

Reimplemented in cv::ocl::CvSVM_OCL.

§ create_solver()

virtual void CvSVM::create_solver ( )
protectedvirtual

Reimplemented in cv::ocl::CvSVM_OCL.

§ do_train()

virtual bool CvSVM::do_train ( int  svm_type,
int  sample_count,
int  var_count,
const float **  samples,
const CvMat responses,
CvMemStorage _storage,
double *  alpha 
)
protectedvirtual

§ get_default_grid()

static CvParamGrid CvSVM::get_default_grid ( int  param_id)
static

§ get_params()

virtual CvSVMParams CvSVM::get_params ( ) const
inlinevirtual

§ get_support_vector()

virtual const float* CvSVM::get_support_vector ( int  i) const
virtual

§ get_support_vector_count()

virtual int CvSVM::get_support_vector_count ( ) const
virtual

§ get_var_count()

int CvSVM::get_var_count ( ) const
inline

§ optimize_linear_svm()

void CvSVM::optimize_linear_svm ( )
protected

§ predict() [1/5]

virtual float CvSVM::predict ( const CvMat sample,
bool  returnDFVal = false 
) const
virtual

§ predict() [2/5]

virtual float CvSVM::predict ( const CvMat samples,
CV_OUT CvMat results 
) const
virtual

Reimplemented in cv::ocl::CvSVM_OCL.

§ predict() [3/5]

virtual float CvSVM::predict ( const cv::Mat sample,
bool  returnDFVal = false 
) const
virtual

Reimplemented in cv::ocl::CvSVM_OCL.

§ predict() [4/5]

void CvSVM::predict ( cv::InputArray  samples,
cv::OutputArray  results 
) const

§ predict() [5/5]

virtual float CvSVM::predict ( const float *  row_sample,
int  row_len,
bool  returnDFVal = false 
) const
protectedvirtual

§ read()

virtual void CvSVM::read ( CvFileStorage storage,
CvFileNode node 
)
virtual

Reimplemented from CvStatModel.

§ read_params()

virtual void CvSVM::read_params ( CvFileStorage fs,
CvFileNode node 
)
protectedvirtual

§ set_params()

virtual bool CvSVM::set_params ( const CvSVMParams params)
protectedvirtual

§ train() [1/2]

virtual bool CvSVM::train ( const CvMat trainData,
const CvMat responses,
const CvMat varIdx = 0,
const CvMat sampleIdx = 0,
CvSVMParams  params = CvSVMParams() 
)
virtual

§ train() [2/2]

virtual 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

§ train1()

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 
)
protectedvirtual

§ train_auto() [1/2]

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

§ train_auto() [2/2]

virtual 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

§ write()

virtual void CvSVM::write ( CvFileStorage storage,
const char *  name 
) const
virtual

Reimplemented from CvStatModel.

§ write_params()

virtual void CvSVM::write_params ( CvFileStorage fs) const
protectedvirtual

Member Data Documentation

§ class_labels

CvMat* CvSVM::class_labels
protected

§ class_weights

CvMat* CvSVM::class_weights
protected

§ decision_func

CvSVMDecisionFunc* CvSVM::decision_func
protected

§ kernel

CvSVMKernel* CvSVM::kernel
protected

§ params

CvSVMParams CvSVM::params
protected

§ solver

CvSVMSolver* CvSVM::solver
protected

§ storage

CvMemStorage* CvSVM::storage
protected

§ sv

float** CvSVM::sv
protected

§ sv_total

int CvSVM::sv_total
protected

§ var_all

int CvSVM::var_all
protected

§ var_idx

CvMat* CvSVM::var_idx
protected

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