C# Class OpenCvSharp.ML.StatModel

Base class for statistical models in ML
Inheritance: Algorithm
显示文件 Open project: shimat/opencvsharp

Public Methods

Method Description
CalcError ( OpenCvSharp.ML.TrainData data, bool test, OutputArray resp ) : float

Computes error on the training or test dataset

Empty ( ) : bool

GetVarCount ( ) : int

Returns the number of variables in training samples

IsClassifier ( ) : bool

Returns true if the model is classifier

IsTrained ( ) : bool

Returns true if the model is trained

Predict ( InputArray samples, OutputArray results = null, Flags flags ) : float

Predicts response(s) for the provided sample(s)

Train ( InputArray samples, SampleTypes layout, InputArray responses ) : bool

Trains the statistical model

Train ( TrainData trainData, int flags ) : bool

Trains the statistical model

Protected Methods

Method Description
StatModel ( ) : System

Default constructor

Method Details

CalcError() public method

Computes error on the training or test dataset
public CalcError ( OpenCvSharp.ML.TrainData data, bool test, OutputArray resp ) : float
data OpenCvSharp.ML.TrainData the training data
test bool if true, the error is computed over the test subset of the data, /// otherwise it's computed over the training subset of the data. Please note that if you /// loaded a completely different dataset to evaluate already trained classifier, you will /// probably want not to set the test subset at all with TrainData::setTrainTestSplitRatio /// and specify test=false, so that the error is computed for the whole new set. Yes, this /// sounds a bit confusing.
resp OutputArray the optional output responses.
return float

Empty() public method

public Empty ( ) : bool
return bool

GetVarCount() public method

Returns the number of variables in training samples
public GetVarCount ( ) : int
return int

IsClassifier() public method

Returns true if the model is classifier
public IsClassifier ( ) : bool
return bool

IsTrained() public method

Returns true if the model is trained
public IsTrained ( ) : bool
return bool

Predict() public method

Predicts response(s) for the provided sample(s)
public Predict ( InputArray samples, OutputArray results = null, Flags flags ) : float
samples InputArray The input samples, floating-point matrix
results OutputArray The optional output matrix of results.
flags Flags The optional flags, model-dependent.
return float

StatModel() protected method

Default constructor
protected StatModel ( ) : System
return System

Train() public method

Trains the statistical model
public Train ( InputArray samples, SampleTypes layout, InputArray responses ) : bool
samples InputArray training samples
layout SampleTypes SampleTypes value
responses InputArray vector of responses associated with the training samples.
return bool

Train() public method

Trains the statistical model
public Train ( TrainData trainData, int flags ) : bool
trainData TrainData training data that can be loaded from file using TrainData::loadFromCSV /// or created with TrainData::create.
flags int optional flags, depending on the model. Some of the models can be updated with the /// new training samples, not completely overwritten (such as NormalBayesClassifier or ANN_MLP).
return bool