mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
integrated most of the new Python stuff into the reference manual
This commit is contained in:
@@ -146,6 +146,8 @@ Trains a boosted tree classifier.
|
||||
|
||||
.. ocv:function:: bool CvBoost::train( const Mat& trainData, int tflag, const Mat& responses, const Mat& varIdx=Mat(), const Mat& sampleIdx=Mat(), const Mat& varType=Mat(), const Mat& missingDataMask=Mat(), CvBoostParams params=CvBoostParams(), bool update=false )
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvBoost.train(trainData, tflag, responses[, varIdx[, sampleIdx[, varType[, missingDataMask[, params[, update]]]]]]) -> retval
|
||||
|
||||
.. ocv:cfunction:: bool CvBoost::train( const CvMat* trainData, int tflag, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0, const CvMat* varType=0, const CvMat* missingDataMask=0, CvBoostParams params=CvBoostParams(), bool update=false )
|
||||
|
||||
.. ocv:cfunction:: bool CvBoost::train( CvMLData* data, CvBoostParams params=CvBoostParams(), bool update=false )
|
||||
@@ -160,6 +162,8 @@ Predicts a response for an input sample.
|
||||
|
||||
.. ocv:function:: float CvBoost::predict( const Mat& sample, const Mat& missing=Mat(), const Range& slice=Range::all(), bool rawMode=false, bool returnSum=false ) const
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvBoost.predict(sample[, missing[, slice[, rawMode[, returnSum]]]]) -> retval
|
||||
|
||||
The method runs the sample through the trees in the ensemble and returns the output class label based on the weighted voting.
|
||||
|
||||
CvBoost::prune
|
||||
@@ -168,6 +172,8 @@ Removes the specified weak classifiers.
|
||||
|
||||
.. ocv:function:: void CvBoost::prune( CvSlice slice )
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvBoost.prune(slice) -> None
|
||||
|
||||
The method removes the specified weak classifiers from the sequence.
|
||||
|
||||
.. note:: Do not confuse this method with the pruning of individual decision trees, which is currently not supported.
|
||||
|
||||
@@ -222,6 +222,8 @@ Trains a decision tree.
|
||||
|
||||
.. ocv:function:: bool CvDTree::train( CvDTreeTrainData* trainData, const CvMat* subsampleIdx )
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvDTree.train(trainData, tflag, responses[, varIdx[, sampleIdx[, varType[, missingDataMask[, params]]]]]) -> retval
|
||||
|
||||
There are four ``train`` methods in :ocv:class:`CvDTree`:
|
||||
|
||||
* The **first two** methods follow the generic ``CvStatModel::train`` conventions. It is the most complete form. Both data layouts (``tflag=CV_ROW_SAMPLE`` and ``tflag=CV_COL_SAMPLE``) are supported, as well as sample and variable subsets, missing measurements, arbitrary combinations of input and output variable types, and so on. The last parameter contains all of the necessary training parameters (see the :ref:`CvDTreeParams` description).
|
||||
@@ -240,6 +242,8 @@ Returns the leaf node of a decision tree corresponding to the input vector.
|
||||
|
||||
.. ocv:function:: CvDTreeNode* CvDTree::predict( const CvMat* sample, const CvMat* missingDataMask=0, bool preprocessedInput=false ) const
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvDTree.predict(sample[, missingDataMask[, preprocessedInput]]) -> retval
|
||||
|
||||
:param sample: Sample for prediction.
|
||||
|
||||
:param missing_data: Optional input missing measurement mask.
|
||||
|
||||
@@ -155,6 +155,8 @@ Estimates the Gaussian mixture parameters from a sample set.
|
||||
|
||||
.. ocv:function:: bool CvEM::train( const CvMat* samples, const CvMat* sampleIdx=0, CvEMParams params=CvEMParams(), CvMat* labels=0 )
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvEM.train(samples[, sampleIdx[, params]]) -> retval, labels
|
||||
|
||||
:param samples: Samples from which the Gaussian mixture model will be estimated.
|
||||
|
||||
:param sample_idx: Mask of samples to use. All samples are used by default.
|
||||
@@ -187,6 +189,8 @@ Returns a mixture component index of a sample.
|
||||
|
||||
.. ocv:function:: float CvEM::predict( const CvMat* sample, CvMat* probs ) const
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvEM.predict(sample) -> retval, probs
|
||||
|
||||
:param sample: A sample for classification.
|
||||
|
||||
:param probs: If it is not null then the method will write posterior probabilities of each component given the sample data to this parameter.
|
||||
|
||||
@@ -169,6 +169,8 @@ Trains a Gradient boosted tree model.
|
||||
|
||||
.. ocv:function:: bool CvGBTrees::train(const Mat& trainData, int tflag, const Mat& responses, const Mat& varIdx=Mat(), const Mat& sampleIdx=Mat(), const Mat& varType=Mat(), const Mat& missingDataMask=Mat(), CvGBTreesParams params=CvGBTreesParams(), bool update=false)
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvGBTrees.train(trainData, tflag, responses[, varIdx[, sampleIdx[, varType[, missingDataMask[, params[, update]]]]]]) -> retval
|
||||
|
||||
.. ocv:cfunction:: bool CvGBTrees::train( const CvMat* trainData, int tflag, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0, const CvMat* varType=0, const CvMat* missingDataMask=0, CvGBTreesParams params=CvGBTreesParams(), bool update=false )
|
||||
|
||||
.. ocv:cfunction:: bool CvGBTrees::train(CvMLData* data, CvGBTreesParams params=CvGBTreesParams(), bool update=false)
|
||||
@@ -194,6 +196,8 @@ Predicts a response for an input sample.
|
||||
|
||||
.. ocv:function:: float CvGBTrees::predict(const Mat& sample, const Mat& missing=Mat(), const Range& slice = Range::all(), int k=-1) const
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvGBTrees.predict(sample[, missing[, slice[, k]]]) -> retval
|
||||
|
||||
.. ocv:cfunction:: float CvGBTrees::predict( const CvMat* sample, const CvMat* missing=0, CvMat* weakResponses=0, CvSlice slice = CV_WHOLE_SEQ, int k=-1 ) const
|
||||
|
||||
:param sample: Input feature vector that has the same format as every training set
|
||||
@@ -235,6 +239,8 @@ Clears the model.
|
||||
|
||||
.. ocv:function:: void CvGBTrees::clear()
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvGBTrees.clear() -> None
|
||||
|
||||
The function deletes the data set information and all the weak models and sets all internal
|
||||
variables to the initial state. The function is called in :ocv:func:`CvGBTrees::train` and in the
|
||||
destructor.
|
||||
|
||||
@@ -29,6 +29,8 @@ Trains the model.
|
||||
|
||||
.. ocv:function:: bool CvKNearest::train( const Mat& trainData, const Mat& responses, const Mat& sampleIdx=Mat(), bool isRegression=false, int maxK=32, bool updateBase=false )
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvKNearest.train(trainData, responses[, sampleIdx[, isRegression[, maxK[, updateBase]]]]) -> retval
|
||||
|
||||
.. ocv:cfunction:: bool CvKNearest::train( const CvMat* trainData, const CvMat* responses, const CvMat* sampleIdx=0, bool is_regression=false, int maxK=32, bool updateBase=false )
|
||||
|
||||
:param isRegression: Type of the problem: ``true`` for regression and ``false`` for classification.
|
||||
@@ -52,6 +54,8 @@ Finds the neighbors and predicts responses for input vectors.
|
||||
|
||||
.. ocv:function:: float CvKNearest::find_nearest( const Mat& samples, int k, Mat& results, Mat& neighborResponses, Mat& dists) const
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvKNearest.find_nearest(samples, k[, results[, neighborResponses[, dists]]]) -> retval, results, neighborResponses, dists
|
||||
|
||||
.. ocv:cfunction:: float CvKNearest::find_nearest( const CvMat* samples, int k, CvMat* results=0, const float** neighbors=0, CvMat* neighborResponses=0, CvMat* dist=0 ) const
|
||||
|
||||
:param samples: Input samples stored by rows. It is a single-precision floating-point matrix of :math:`number\_of\_samples \times number\_of\_features` size.
|
||||
|
||||
@@ -33,6 +33,8 @@ Trains the model.
|
||||
|
||||
.. ocv:function:: bool CvNormalBayesClassifier::train( const Mat& trainData, const Mat& responses, const Mat& varIdx = Mat(), const Mat& sampleIdx=Mat(), bool update=false )
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvNormalBayesClassifier.train(trainData, responses[, varIdx[, sampleIdx[, update]]]) -> retval
|
||||
|
||||
.. ocv:cfunction:: bool CvNormalBayesClassifier::train( const CvMat* trainData, const CvMat* responses, const CvMat* varIdx = 0, const CvMat* sampleIdx=0, bool update=false )
|
||||
|
||||
:param update: Identifies whether the model should be trained from scratch (``update=false``) or should be updated using the new training data (``update=true``).
|
||||
@@ -50,6 +52,8 @@ Predicts the response for sample(s).
|
||||
|
||||
.. ocv:function:: float CvNormalBayesClassifier::predict( const Mat& samples, Mat* results=0 ) const
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvNormalBayesClassifier.predict(samples) -> retval, results
|
||||
|
||||
.. ocv:cfunction:: float CvNormalBayesClassifier::predict( const CvMat* samples, CvMat* results=0 ) const
|
||||
|
||||
The method estimates the most probable classes for input vectors. Input vectors (one or more) are stored as rows of the matrix ``samples``. In case of multiple input vectors, there should be one output vector ``results``. The predicted class for a single input vector is returned by the method.
|
||||
|
||||
@@ -105,6 +105,8 @@ Trains the Random Trees model.
|
||||
|
||||
.. ocv:function:: bool CvRTrees::train( const CvMat* trainData, int tflag, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0, const CvMat* varType=0, const CvMat* missingDataMask=0, CvRTParams params=CvRTParams() )
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvRTrees.train(trainData, tflag, responses[, varIdx[, sampleIdx[, varType[, missingDataMask[, params]]]]]) -> retval
|
||||
|
||||
The method :ocv:func:`CvRTrees::train` is very similar to the method :ocv:func:`CvDTree::train` and follows the generic method :ocv:func:`CvStatModel::train` conventions. All the parameters specific to the algorithm training are passed as a :ocv:class:`CvRTParams` instance. The estimate of the training error (``oob-error``) is stored in the protected class member ``oob_error``.
|
||||
|
||||
CvRTrees::predict
|
||||
@@ -115,6 +117,8 @@ Predicts the output for an input sample.
|
||||
|
||||
.. ocv:function:: float CvRTrees::predict( const CvMat* sample, const CvMat* missing = 0 ) const
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvRTrees.predict(sample[, missing]) -> retval
|
||||
|
||||
:param sample: Sample for classification.
|
||||
|
||||
:param missing: Optional missing measurement mask of the sample.
|
||||
@@ -130,6 +134,8 @@ Returns a fuzzy-predicted class label.
|
||||
|
||||
.. ocv:function:: float CvRTrees::predict_prob( const CvMat* sample, const CvMat* missing = 0 ) const
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvRTrees.predict_prob(sample[, missing]) -> retval
|
||||
|
||||
:param sample: Sample for classification.
|
||||
|
||||
:param missing: Optional missing measurement mask of the sample.
|
||||
|
||||
@@ -89,6 +89,8 @@ Saves the model to a file.
|
||||
|
||||
.. ocv:function:: void CvStatModel::save( const char* filename, const char* name=0 )
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvStatModel.save(filename[, name]) -> None
|
||||
|
||||
The method ``save`` saves the complete model state to the specified XML or YAML file with the specified name or default name (which depends on a particular class). *Data persistence* functionality from ``CxCore`` is used.
|
||||
|
||||
CvStatModel::load
|
||||
@@ -97,6 +99,8 @@ Loads the model from a file.
|
||||
|
||||
.. ocv:function:: void CvStatModel::load( const char* filename, const char* name=0 )
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvStatModel.load(filename[, name]) -> None
|
||||
|
||||
The method ``load`` loads the complete model state with the specified name (or default model-dependent name) from the specified XML or YAML file. The previous model state is cleared by ``clear()`` .
|
||||
|
||||
|
||||
|
||||
@@ -117,6 +117,8 @@ Trains an SVM.
|
||||
|
||||
.. ocv:function:: bool CvSVM::train( const Mat& _train_data, const Mat& _responses, const Mat& _var_idx=Mat(), const Mat& _sample_idx=Mat(), CvSVMParams _params=CvSVMParams() )
|
||||
|
||||
.. ocv:pyfunction:: cv2.CvSVM.train(trainData, responses[, varIdx[, sampleIdx[, params]]]) -> retval
|
||||
|
||||
The method trains the SVM model. It follows the conventions of the generic ``train`` approach with the following limitations:
|
||||
|
||||
* Only the ``CV_ROW_SAMPLE`` data layout is supported.
|
||||
|
||||
Reference in New Issue
Block a user