View Source Evision.ML.ANNMLP (Evision v0.1.7)
Link to this section Summary
cv
Clears the algorithm state
Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.
Reads algorithm parameters from a file storage
Positional Arguments
- filename:
String
Saves the algorithm to a file. In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).
simplified API for language bindings
simplified API for language bindings
cv.ml
Computes error on the training or test dataset
Computes error on the training or test dataset
Creates empty model
Python prototype (for reference):
@see setAnnealCoolingRatio
@see setAnnealFinalT
@see setAnnealInitialT
@see setAnnealItePerStep
@see setBackpropMomentumScale
@see setBackpropWeightScale
Integer vector specifying the number of neurons in each layer including the input and output layers. The very first element specifies the number of elements in the input layer. The last element - number of elements in the output layer. @sa setLayerSizes
@see setRpropDW0
@see setRpropDWMax
@see setRpropDWMin
@see setRpropDWMinus
@see setRpropDWPlus
@see setTermCriteria
Returns current training method
Returns the number of variables in training samples
Positional Arguments
- layerIdx:
int
Python prototype (for reference):
Returns true if the model is classifier
Returns true if the model is trained
Loads and creates a serialized ANN from a file
Predicts response(s) for the provided sample(s)
Predicts response(s) for the provided sample(s)
Positional Arguments
type:
int
.
Positional Arguments
type:
int
.
Positional Arguments
- val:
double
@copybrief getAnnealCoolingRatio @see getAnnealCoolingRatio
Positional Arguments
- val:
double
@copybrief getAnnealFinalT @see getAnnealFinalT
Positional Arguments
- val:
double
@copybrief getAnnealInitialT @see getAnnealInitialT
Positional Arguments
- val:
int
@copybrief getAnnealItePerStep @see getAnnealItePerStep
Positional Arguments
- val:
double
@copybrief getBackpropMomentumScale @see getBackpropMomentumScale
Positional Arguments
- val:
double
@copybrief getBackpropWeightScale @see getBackpropWeightScale
Positional Arguments
- layer_sizes:
Evision.Mat
Integer vector specifying the number of neurons in each layer including the input and output layers. The very first element specifies the number of elements in the input layer. The last element - number of elements in the output layer. Default value is empty Mat. @sa getLayerSizes
Positional Arguments
- val:
double
@copybrief getRpropDW0 @see getRpropDW0
Positional Arguments
- val:
double
@copybrief getRpropDWMax @see getRpropDWMax
Positional Arguments
- val:
double
@copybrief getRpropDWMin @see getRpropDWMin
Positional Arguments
- val:
double
@copybrief getRpropDWMinus @see getRpropDWMinus
Positional Arguments
- val:
double
@copybrief getRpropDWPlus @see getRpropDWPlus
Positional Arguments
- val:
TermCriteria
@copybrief getTermCriteria @see getTermCriteria
Positional Arguments
method:
int
.
Positional Arguments
method:
int
.
Trains the statistical model
Trains the statistical model
Trains the statistical model
Functions
Raising version of calcError/3
.
Raising version of calcError/4
.
Raising version of clear/1
.
Raising version of empty/1
.
Raising version of getAnnealCoolingRatio/1
.
Raising version of getAnnealFinalT/1
.
Raising version of getAnnealInitialT/1
.
Raising version of getAnnealItePerStep/1
.
Raising version of getBackpropMomentumScale/1
.
Raising version of getBackpropWeightScale/1
.
Raising version of getDefaultName/1
.
Raising version of getLayerSizes/1
.
Raising version of getRpropDW0/1
.
Raising version of getRpropDWMax/1
.
Raising version of getRpropDWMin/1
.
Raising version of getRpropDWMinus/1
.
Raising version of getRpropDWPlus/1
.
Raising version of getTermCriteria/1
.
Raising version of getTrainMethod/1
.
Raising version of getVarCount/1
.
Raising version of getWeights/2
.
Raising version of isClassifier/1
.
Raising version of isTrained/1
.
Raising version of load/1
.
Raising version of predict/2
.
Raising version of predict/3
.
Raising version of read/2
.
Raising version of save/2
.
Raising version of setActivationFunction/2
.
Raising version of setActivationFunction/3
.
Raising version of setAnnealCoolingRatio/2
.
Raising version of setAnnealFinalT/2
.
Raising version of setAnnealInitialT/2
.
Raising version of setAnnealItePerStep/2
.
Raising version of setBackpropMomentumScale/2
.
Raising version of setBackpropWeightScale/2
.
Raising version of setLayerSizes/2
.
Raising version of setRpropDW0/2
.
Raising version of setRpropDWMax/2
.
Raising version of setRpropDWMin/2
.
Raising version of setRpropDWMinus/2
.
Raising version of setRpropDWPlus/2
.
Raising version of setTermCriteria/2
.
Raising version of setTrainMethod/2
.
Raising version of setTrainMethod/3
.
Raising version of train/2
.
Raising version of train/3
.
Raising version of train/4
.
Raising version of write/2
.
Raising version of write/3
.
Link to this section cv
Clears the algorithm state
Python prototype (for reference):
clear() -> None
Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.
Python prototype (for reference):
getDefaultName() -> retval
Reads algorithm parameters from a file storage
Positional Arguments
- fn_:
FileNode
Python prototype (for reference):
read(fn_) -> None
Positional Arguments
- filename:
String
Saves the algorithm to a file. In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).
Python prototype (for reference):
save(filename) -> None
simplified API for language bindings
Positional Arguments
- fs:
Ptr<FileStorage>
Keyword Arguments
- name:
String
.
Has overloading in C++
Python prototype (for reference):
write(fs[, name]) -> None
simplified API for language bindings
Positional Arguments
- fs:
Ptr<FileStorage>
Keyword Arguments
- name:
String
.
Has overloading in C++
Python prototype (for reference):
write(fs[, name]) -> None
Link to this section cv.ml
Computes error on the training or test dataset
Positional Arguments
data:
Ptr<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.
Return
resp:
Evision.Mat
.the optional output responses.
The method uses StatModel::predict to compute the error. For regression models the error is computed as RMS, for classifiers - as a percent of missclassified samples (0%-100%).
Python prototype (for reference):
calcError(data, test[, resp]) -> retval, resp
Computes error on the training or test dataset
Positional Arguments
data:
Ptr<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.
Return
resp:
Evision.Mat
.the optional output responses.
The method uses StatModel::predict to compute the error. For regression models the error is computed as RMS, for classifiers - as a percent of missclassified samples (0%-100%).
Python prototype (for reference):
calcError(data, test[, resp]) -> retval, resp
Creates empty model
Use StatModel::train to train the model, Algorithm::load\<ANN_MLP>(filename) to load the pre-trained model. Note that the train method has optional flags: ANN_MLP::TrainFlags.
Python prototype (for reference):
create() -> retval
Python prototype (for reference):
empty() -> retval
@see setAnnealCoolingRatio
Python prototype (for reference):
getAnnealCoolingRatio() -> retval
@see setAnnealFinalT
Python prototype (for reference):
getAnnealFinalT() -> retval
@see setAnnealInitialT
Python prototype (for reference):
getAnnealInitialT() -> retval
@see setAnnealItePerStep
Python prototype (for reference):
getAnnealItePerStep() -> retval
@see setBackpropMomentumScale
Python prototype (for reference):
getBackpropMomentumScale() -> retval
@see setBackpropWeightScale
Python prototype (for reference):
getBackpropWeightScale() -> retval
Integer vector specifying the number of neurons in each layer including the input and output layers. The very first element specifies the number of elements in the input layer. The last element - number of elements in the output layer. @sa setLayerSizes
Python prototype (for reference):
getLayerSizes() -> retval
@see setRpropDW0
Python prototype (for reference):
getRpropDW0() -> retval
@see setRpropDWMax
Python prototype (for reference):
getRpropDWMax() -> retval
@see setRpropDWMin
Python prototype (for reference):
getRpropDWMin() -> retval
@see setRpropDWMinus
Python prototype (for reference):
getRpropDWMinus() -> retval
@see setRpropDWPlus
Python prototype (for reference):
getRpropDWPlus() -> retval
@see setTermCriteria
Python prototype (for reference):
getTermCriteria() -> retval
Returns current training method
Python prototype (for reference):
getTrainMethod() -> retval
Returns the number of variables in training samples
Python prototype (for reference):
getVarCount() -> retval
Positional Arguments
- layerIdx:
int
Python prototype (for reference):
getWeights(layerIdx) -> retval
Returns true if the model is classifier
Python prototype (for reference):
isClassifier() -> retval
Returns true if the model is trained
Python prototype (for reference):
isTrained() -> retval
Loads and creates a serialized ANN from a file
Positional Arguments
filepath:
String
.path to serialized ANN
Use ANN::save to serialize and store an ANN to disk. Load the ANN from this file again, by calling this function with the path to the file.
Python prototype (for reference):
load(filepath) -> retval
Predicts response(s) for the provided sample(s)
Positional Arguments
samples:
Evision.Mat
.The input samples, floating-point matrix
Keyword Arguments
flags:
int
.The optional flags, model-dependent. See cv::ml::StatModel::Flags.
Return
results:
Evision.Mat
.The optional output matrix of results.
Python prototype (for reference):
predict(samples[, results[, flags]]) -> retval, results
Predicts response(s) for the provided sample(s)
Positional Arguments
samples:
Evision.Mat
.The input samples, floating-point matrix
Keyword Arguments
flags:
int
.The optional flags, model-dependent. See cv::ml::StatModel::Flags.
Return
results:
Evision.Mat
.The optional output matrix of results.
Python prototype (for reference):
predict(samples[, results[, flags]]) -> retval, results
Positional Arguments
type:
int
.The type of activation function. See ANN_MLP::ActivationFunctions.
Keyword Arguments
param1:
double
.The first parameter of the activation function, \f$\alpha\f$. Default value is 0.
param2:
double
.The second parameter of the activation function, \f$\beta\f$. Default value is 0.
Initialize the activation function for each neuron. Currently the default and the only fully supported activation function is ANN_MLP::SIGMOID_SYM.
Python prototype (for reference):
setActivationFunction(type[, param1[, param2]]) -> None
Positional Arguments
type:
int
.The type of activation function. See ANN_MLP::ActivationFunctions.
Keyword Arguments
param1:
double
.The first parameter of the activation function, \f$\alpha\f$. Default value is 0.
param2:
double
.The second parameter of the activation function, \f$\beta\f$. Default value is 0.
Initialize the activation function for each neuron. Currently the default and the only fully supported activation function is ANN_MLP::SIGMOID_SYM.
Python prototype (for reference):
setActivationFunction(type[, param1[, param2]]) -> None
Positional Arguments
- val:
double
@copybrief getAnnealCoolingRatio @see getAnnealCoolingRatio
Python prototype (for reference):
setAnnealCoolingRatio(val) -> None
Positional Arguments
- val:
double
@copybrief getAnnealFinalT @see getAnnealFinalT
Python prototype (for reference):
setAnnealFinalT(val) -> None
Positional Arguments
- val:
double
@copybrief getAnnealInitialT @see getAnnealInitialT
Python prototype (for reference):
setAnnealInitialT(val) -> None
Positional Arguments
- val:
int
@copybrief getAnnealItePerStep @see getAnnealItePerStep
Python prototype (for reference):
setAnnealItePerStep(val) -> None
Positional Arguments
- val:
double
@copybrief getBackpropMomentumScale @see getBackpropMomentumScale
Python prototype (for reference):
setBackpropMomentumScale(val) -> None
Positional Arguments
- val:
double
@copybrief getBackpropWeightScale @see getBackpropWeightScale
Python prototype (for reference):
setBackpropWeightScale(val) -> None
Positional Arguments
- layer_sizes:
Evision.Mat
Integer vector specifying the number of neurons in each layer including the input and output layers. The very first element specifies the number of elements in the input layer. The last element - number of elements in the output layer. Default value is empty Mat. @sa getLayerSizes
Python prototype (for reference):
setLayerSizes(_layer_sizes) -> None
Positional Arguments
- val:
double
@copybrief getRpropDW0 @see getRpropDW0
Python prototype (for reference):
setRpropDW0(val) -> None
Positional Arguments
- val:
double
@copybrief getRpropDWMax @see getRpropDWMax
Python prototype (for reference):
setRpropDWMax(val) -> None
Positional Arguments
- val:
double
@copybrief getRpropDWMin @see getRpropDWMin
Python prototype (for reference):
setRpropDWMin(val) -> None
Positional Arguments
- val:
double
@copybrief getRpropDWMinus @see getRpropDWMinus
Python prototype (for reference):
setRpropDWMinus(val) -> None
Positional Arguments
- val:
double
@copybrief getRpropDWPlus @see getRpropDWPlus
Python prototype (for reference):
setRpropDWPlus(val) -> None
Positional Arguments
- val:
TermCriteria
@copybrief getTermCriteria @see getTermCriteria
Python prototype (for reference):
setTermCriteria(val) -> None
Positional Arguments
method:
int
.Default value is ANN_MLP::RPROP. See ANN_MLP::TrainingMethods.
Keyword Arguments
param1:
double
.passed to setRpropDW0 for ANN_MLP::RPROP and to setBackpropWeightScale for ANN_MLP::BACKPROP and to initialT for ANN_MLP::ANNEAL.
param2:
double
.passed to setRpropDWMin for ANN_MLP::RPROP and to setBackpropMomentumScale for ANN_MLP::BACKPROP and to finalT for ANN_MLP::ANNEAL.
Sets training method and common parameters.
Python prototype (for reference):
setTrainMethod(method[, param1[, param2]]) -> None
Positional Arguments
method:
int
.Default value is ANN_MLP::RPROP. See ANN_MLP::TrainingMethods.
Keyword Arguments
param1:
double
.passed to setRpropDW0 for ANN_MLP::RPROP and to setBackpropWeightScale for ANN_MLP::BACKPROP and to initialT for ANN_MLP::ANNEAL.
param2:
double
.passed to setRpropDWMin for ANN_MLP::RPROP and to setBackpropMomentumScale for ANN_MLP::BACKPROP and to finalT for ANN_MLP::ANNEAL.
Sets training method and common parameters.
Python prototype (for reference):
setTrainMethod(method[, param1[, param2]]) -> None
Trains the statistical model
Positional Arguments
trainData:
Ptr<TrainData>
.training data that can be loaded from file using TrainData::loadFromCSV or created with TrainData::create.
Keyword Arguments
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).
Python prototype (for reference):
train(trainData[, flags]) -> retval
Trains the statistical model
Positional Arguments
trainData:
Ptr<TrainData>
.training data that can be loaded from file using TrainData::loadFromCSV or created with TrainData::create.
Keyword Arguments
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).
Python prototype (for reference):
train(trainData[, flags]) -> retval
Trains the statistical model
Positional Arguments
samples:
Evision.Mat
.training samples
layout:
int
.See ml::SampleTypes.
responses:
Evision.Mat
.vector of responses associated with the training samples.
Python prototype (for reference):
train(samples, layout, responses) -> retval
Link to this section Functions
Raising version of calcError/3
.
Raising version of calcError/4
.
Raising version of clear/1
.
Raising version of create/0
.
Raising version of empty/1
.
Raising version of getAnnealCoolingRatio/1
.
Raising version of getAnnealFinalT/1
.
Raising version of getAnnealInitialT/1
.
Raising version of getAnnealItePerStep/1
.
Raising version of getBackpropMomentumScale/1
.
Raising version of getBackpropWeightScale/1
.
Raising version of getDefaultName/1
.
Raising version of getLayerSizes/1
.
Raising version of getRpropDW0/1
.
Raising version of getRpropDWMax/1
.
Raising version of getRpropDWMin/1
.
Raising version of getRpropDWMinus/1
.
Raising version of getRpropDWPlus/1
.
Raising version of getTermCriteria/1
.
Raising version of getTrainMethod/1
.
Raising version of getVarCount/1
.
Raising version of getWeights/2
.
Raising version of isClassifier/1
.
Raising version of isTrained/1
.
Raising version of load/1
.
Raising version of predict/2
.
Raising version of predict/3
.
Raising version of read/2
.
Raising version of save/2
.
Raising version of setActivationFunction/2
.
Raising version of setActivationFunction/3
.
Raising version of setAnnealCoolingRatio/2
.
Raising version of setAnnealFinalT/2
.
Raising version of setAnnealInitialT/2
.
Raising version of setAnnealItePerStep/2
.
Raising version of setBackpropMomentumScale/2
.
Raising version of setBackpropWeightScale/2
.
Raising version of setLayerSizes/2
.
Raising version of setRpropDW0/2
.
Raising version of setRpropDWMax/2
.
Raising version of setRpropDWMin/2
.
Raising version of setRpropDWMinus/2
.
Raising version of setRpropDWPlus/2
.
Raising version of setTermCriteria/2
.
Raising version of setTrainMethod/2
.
Raising version of setTrainMethod/3
.
Raising version of train/2
.
Raising version of train/3
.
Raising version of train/4
.
Raising version of write/2
.
Raising version of write/3
.