@Namespace(value="cv::ml") public static class opencv_ml.StatModel extends opencv_ml.AbstractStatModel
| Modifier and Type | Field and Description |
|---|---|
static int |
COMPRESSED_INPUT
enum cv::ml::StatModel::Flags
|
static int |
PREPROCESSED_INPUT
enum cv::ml::StatModel::Flags
|
static int |
RAW_OUTPUT
enum cv::ml::StatModel::Flags
|
static int |
UPDATE_MODEL
enum cv::ml::StatModel::Flags
|
| Constructor and Description |
|---|
StatModel(org.bytedeco.javacpp.Pointer p)
Pointer cast constructor.
|
| Modifier and Type | Method and Description |
|---|---|
float |
calcError(opencv_ml.TrainData data,
boolean test,
opencv_core.GpuMat resp) |
float |
calcError(opencv_ml.TrainData data,
boolean test,
opencv_core.Mat resp)
\brief Computes error on the training or test dataset
|
float |
calcError(opencv_ml.TrainData data,
boolean test,
opencv_core.UMat resp) |
boolean |
empty()
\brief Returns true if the Algorithm is empty (e.g.
|
int |
getVarCount()
\brief Returns the number of variables in training samples
|
boolean |
isClassifier()
\brief Returns true if the model is classifier
|
boolean |
isTrained()
\brief Returns true if the model is trained
|
float |
predict(opencv_core.GpuMat samples) |
float |
predict(opencv_core.GpuMat samples,
opencv_core.GpuMat results,
int flags) |
float |
predict(opencv_core.Mat samples) |
float |
predict(opencv_core.Mat samples,
opencv_core.Mat results,
int flags)
\brief Predicts response(s) for the provided sample(s)
|
float |
predict(opencv_core.UMat samples) |
float |
predict(opencv_core.UMat samples,
opencv_core.UMat results,
int flags) |
boolean |
train(opencv_core.GpuMat samples,
int layout,
opencv_core.GpuMat responses) |
boolean |
train(opencv_core.Mat samples,
int layout,
opencv_core.Mat responses)
\brief Trains the statistical model
|
boolean |
train(opencv_core.UMat samples,
int layout,
opencv_core.UMat responses) |
boolean |
train(opencv_ml.TrainData trainData) |
boolean |
train(opencv_ml.TrainData trainData,
int flags)
\brief Trains the statistical model
|
loadANN_MLP, loadANN_MLP, loadBoost, loadBoost, loadDTrees, loadDTrees, loadEM, loadEM, loadKNearest, loadKNearest, loadLogisticRegression, loadLogisticRegression, loadNormalBayesClassifier, loadNormalBayesClassifier, loadRTrees, loadRTrees, loadSVM, loadSVMclear, getDefaultName, position, read, save, save, write, write, writeaddress, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zeropublic static final int UPDATE_MODEL
public static final int RAW_OUTPUT
public static final int COMPRESSED_INPUT
public static final int PREPROCESSED_INPUT
public StatModel(org.bytedeco.javacpp.Pointer p)
Pointer.Pointer(Pointer).public int getVarCount()
@Cast(value="bool") public boolean empty()
opencv_core.Algorithmempty in class opencv_core.Algorithm@Cast(value="bool") public boolean isTrained()
@Cast(value="bool") public boolean isClassifier()
@Cast(value="bool") public boolean train(@opencv_core.Ptr opencv_ml.TrainData trainData, int flags)
trainData - training data that can be loaded from file using TrainData::loadFromCSV or
created with TrainData::create.flags - 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).@Cast(value="bool") public boolean train(@opencv_core.Ptr opencv_ml.TrainData trainData)
@Cast(value="bool")
public boolean train(@ByVal
opencv_core.Mat samples,
int layout,
@ByVal
opencv_core.Mat responses)
samples - training sampleslayout - See ml::SampleTypes.responses - vector of responses associated with the training samples.@Cast(value="bool")
public boolean train(@ByVal
opencv_core.UMat samples,
int layout,
@ByVal
opencv_core.UMat responses)
@Cast(value="bool")
public boolean train(@ByVal
opencv_core.GpuMat samples,
int layout,
@ByVal
opencv_core.GpuMat responses)
public float calcError(@opencv_core.Ptr opencv_ml.TrainData data, @Cast(value="bool") boolean test, @ByVal opencv_core.Mat resp)
data - the training datatest - 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 - 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%).
public float calcError(@opencv_core.Ptr opencv_ml.TrainData data, @Cast(value="bool") boolean test, @ByVal opencv_core.UMat resp)
public float calcError(@opencv_core.Ptr opencv_ml.TrainData data, @Cast(value="bool") boolean test, @ByVal opencv_core.GpuMat resp)
public float predict(@ByVal
opencv_core.Mat samples,
@ByVal(nullValue="cv::OutputArray(cv::noArray())")
opencv_core.Mat results,
int flags)
samples - The input samples, floating-point matrixresults - The optional output matrix of results.flags - The optional flags, model-dependent. See cv::ml::StatModel::Flags.public float predict(@ByVal
opencv_core.Mat samples)
public float predict(@ByVal
opencv_core.UMat samples,
@ByVal(nullValue="cv::OutputArray(cv::noArray())")
opencv_core.UMat results,
int flags)
public float predict(@ByVal
opencv_core.UMat samples)
public float predict(@ByVal
opencv_core.GpuMat samples,
@ByVal(nullValue="cv::OutputArray(cv::noArray())")
opencv_core.GpuMat results,
int flags)
public float predict(@ByVal
opencv_core.GpuMat samples)
Copyright © 2018. All rights reserved.