View Source Evision.ML.SVMSGD (Evision v0.1.9)
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. Use StatModel::train to train the model. Since %SVMSGD has several parameters, you may want to find the best parameters for your problem or use setOptimalParameters() to set some default parameters.
Python prototype (for reference):
@see setInitialStepSize
@see setMarginRegularization
@see setMarginType
@return the shift of the trained model (decision function f(x) = weights * x + shift).
@see setStepDecreasingPower
@see setSvmsgdType
@see setTermCriteria
Returns the number of variables in training samples
@return the weights of the trained model (decision function f(x) = weights * x + shift).
Returns true if the model is classifier
Returns true if the model is trained
Loads and creates a serialized SVMSGD from a file
Loads and creates a serialized SVMSGD from a file
Predicts response(s) for the provided sample(s)
Predicts response(s) for the provided sample(s)
Positional Arguments
- initialStepSize:
float
@copybrief getInitialStepSize @see getInitialStepSize
Positional Arguments
- marginRegularization:
float
@copybrief getMarginRegularization @see getMarginRegularization
Positional Arguments
- marginType:
int
@copybrief getMarginType @see getMarginType
Function sets optimal parameters values for chosen SVM SGD model.
Positional Arguments
- stepDecreasingPower:
float
@copybrief getStepDecreasingPower @see getStepDecreasingPower
Positional Arguments
- svmsgdType:
int
@copybrief getSvmsgdType @see getSvmsgdType
Positional Arguments
- val:
TermCriteria
@copybrief getTermCriteria @see getTermCriteria
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 getDefaultName/1
.
Raising version of getInitialStepSize/1
.
Raising version of getMarginRegularization/1
.
Raising version of getMarginType/1
.
Raising version of getShift/1
.
Raising version of getStepDecreasingPower/1
.
Raising version of getSvmsgdType/1
.
Raising version of getTermCriteria/1
.
Raising version of getVarCount/1
.
Raising version of getWeights/1
.
Raising version of isClassifier/1
.
Raising version of isTrained/1
.
Raising version of load/1
.
Raising version of load/2
.
Raising version of predict/2
.
Raising version of predict/3
.
Raising version of read/2
.
Raising version of save/2
.
Raising version of setInitialStepSize/2
.
Raising version of setMarginRegularization/2
.
Raising version of setMarginType/2
.
Raising version of setOptimalParameters/1
.
Raising version of setStepDecreasingPower/2
.
Raising version of setSvmsgdType/2
.
Raising version of setTermCriteria/2
.
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. Since %SVMSGD has several parameters, you may want to find the best parameters for your problem or use setOptimalParameters() to set some default parameters.
Python prototype (for reference):
create() -> retval
Python prototype (for reference):
empty() -> retval
@see setInitialStepSize
Python prototype (for reference):
getInitialStepSize() -> retval
@see setMarginRegularization
Python prototype (for reference):
getMarginRegularization() -> retval
@see setMarginType
Python prototype (for reference):
getMarginType() -> retval
@return the shift of the trained model (decision function f(x) = weights * x + shift).
Python prototype (for reference):
getShift() -> retval
@see setStepDecreasingPower
Python prototype (for reference):
getStepDecreasingPower() -> retval
@see setSvmsgdType
Python prototype (for reference):
getSvmsgdType() -> retval
@see setTermCriteria
Python prototype (for reference):
getTermCriteria() -> retval
Returns the number of variables in training samples
Python prototype (for reference):
getVarCount() -> retval
@return the weights of the trained model (decision function f(x) = weights * x + shift).
Python prototype (for reference):
getWeights() -> 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 SVMSGD from a file
Positional Arguments
filepath:
String
.path to serialized SVMSGD
Keyword Arguments
nodeName:
String
.name of node containing the classifier
Use SVMSGD::save to serialize and store an SVMSGD to disk. Load the SVMSGD from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier
Python prototype (for reference):
load(filepath[, nodeName]) -> retval
Loads and creates a serialized SVMSGD from a file
Positional Arguments
filepath:
String
.path to serialized SVMSGD
Keyword Arguments
nodeName:
String
.name of node containing the classifier
Use SVMSGD::save to serialize and store an SVMSGD to disk. Load the SVMSGD from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier
Python prototype (for reference):
load(filepath[, nodeName]) -> 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
- initialStepSize:
float
@copybrief getInitialStepSize @see getInitialStepSize
Python prototype (for reference):
setInitialStepSize(InitialStepSize) -> None
Positional Arguments
- marginRegularization:
float
@copybrief getMarginRegularization @see getMarginRegularization
Python prototype (for reference):
setMarginRegularization(marginRegularization) -> None
Positional Arguments
- marginType:
int
@copybrief getMarginType @see getMarginType
Python prototype (for reference):
setMarginType(marginType) -> None
Function sets optimal parameters values for chosen SVM SGD model.
Keyword Arguments
svmsgdType:
int
.is the type of SVMSGD classifier.
marginType:
int
.is the type of margin constraint.
Python prototype (for reference):
setOptimalParameters([, svmsgdType[, marginType]]) -> None
Positional Arguments
- stepDecreasingPower:
float
@copybrief getStepDecreasingPower @see getStepDecreasingPower
Python prototype (for reference):
setStepDecreasingPower(stepDecreasingPower) -> None
Positional Arguments
- svmsgdType:
int
@copybrief getSvmsgdType @see getSvmsgdType
Python prototype (for reference):
setSvmsgdType(svmsgdType) -> None
Positional Arguments
- val:
TermCriteria
@copybrief getTermCriteria @see getTermCriteria
Python prototype (for reference):
setTermCriteria(val) -> 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 getDefaultName/1
.
Raising version of getInitialStepSize/1
.
Raising version of getMarginRegularization/1
.
Raising version of getMarginType/1
.
Raising version of getShift/1
.
Raising version of getStepDecreasingPower/1
.
Raising version of getSvmsgdType/1
.
Raising version of getTermCriteria/1
.
Raising version of getVarCount/1
.
Raising version of getWeights/1
.
Raising version of isClassifier/1
.
Raising version of isTrained/1
.
Raising version of load/1
.
Raising version of load/2
.
Raising version of predict/2
.
Raising version of predict/3
.
Raising version of read/2
.
Raising version of save/2
.
Raising version of setInitialStepSize/2
.
Raising version of setMarginRegularization/2
.
Raising version of setMarginType/2
.
Raising version of setOptimalParameters/1
.
Raising version of setStepDecreasingPower/2
.
Raising version of setSvmsgdType/2
.
Raising version of setTermCriteria/2
.
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
.