1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

propagated some more fixes from 2.3 branch to the trunk

This commit is contained in:
Vadim Pisarevsky
2011-06-30 12:06:26 +00:00
parent f4894d57cd
commit cc9a1bb62f
32 changed files with 564 additions and 575 deletions
+7 -9
View File
@@ -78,7 +78,7 @@ The structure represents a possible decision tree node split. It has public memb
Pointer to the next split in the node list of splits.
.. ocv:member:: int subset[2]
.. ocv:member:: int[] subset
Bit array indicating the value subset in case of split on a categorical variable. The rule is:
@@ -90,13 +90,11 @@ The structure represents a possible decision tree node split. It has public memb
.. ocv:member:: float ord.c
The threshold value in case of split on an ordered variable. The rule is:
The threshold value in case of split on an ordered variable. The rule is: ::
::
if var_value < c
then next_node<-left
else next_node<-right
if var_value < c
then next_node<-left
else next_node<-right
.. ocv:member:: int ord.split_point
@@ -125,7 +123,7 @@ The structure represents a node in a decision tree. It has public members:
Pointer to the parent node.
.. ocv:mebmer:: CvDTreeNode* left
.. ocv:member:: CvDTreeNode* left
Pointer to the left child node.
@@ -137,7 +135,7 @@ The structure represents a node in a decision tree. It has public members:
Pointer to the first (primary) split in the node list of splits.
.. ocv:mebmer:: int sample_count
.. ocv:member:: int sample_count
The number of samples that fall into the node at the training stage. It is used to resolve the difficult cases - when the variable for the primary split is missing and all the variables for other surrogate splits are missing too. In this case the sample is directed to the left if ``left->sample_count > right->sample_count`` and to the right otherwise.
+2 -2
View File
@@ -62,7 +62,7 @@ Alternatively, the algorithm may start with the M-step when the initial values f
:math:`p_{i,k}` can be provided. Another alternative when
:math:`p_{i,k}` are unknown is to use a simpler clustering algorithm to pre-cluster the input samples and thus obtain initial
:math:`p_{i,k}` . Often (including macnine learning) the
:ref:`kmeans` algorithm is used for that purpose.
:ocv:func:`kmeans` algorithm is used for that purpose.
One of the main problems of the EM algorithm is a large number
of parameters to estimate. The majority of the parameters reside in
@@ -176,7 +176,7 @@ Unlike many of the ML models, EM is an unsupervised learning algorithm and it do
:math:`\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N` (indices of the most probable mixture component for each sample).
The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the
:ref:`Bayes classifier`.
:ocv:class:`CvBayesClassifier`.
For an example of clustering random samples of the multi-Gaussian distribution using EM, see ``em.cpp`` sample in the OpenCV distribution.
+8 -6
View File
@@ -13,6 +13,7 @@ differential loss function, some popular ones are implemented.
Decision trees (:ocv:class:`CvDTree`) usage as base learners allows to process ordered
and categorical variables.
.. _Training GBT:
Training the GBT model
----------------------
@@ -67,7 +68,7 @@ The following loss functions are implemented for regression problems:
\delta\cdot\left(|y-f(x)|-\dfrac{\delta}{2}\right) & : |y-f(x)|>\delta\\
\dfrac{1}{2}\cdot(y-f(x))^2 & : |y-f(x)|\leq\delta \end{array} \right.`,
where :math:`\delta` is the :math:`\alpha`-quantile estimation of the
where :math:`\delta` is the :math:`\alpha`-quantile estimation of the
:math:`|y-f(x)|`. In the current implementation :math:`\alpha=0.2`.
@@ -88,9 +89,10 @@ where :math:`f_0` is the initial guess (the best constant model) and :math:`\nu`
is a regularization parameter from the interval :math:`(0,1]`, futher called
*shrinkage*.
.. _Predicting with GBT:
Predicting with the GBT Model
-------------------------
-----------------------------
To get the GBT model prediciton, you need to compute the sum of responses of
all the trees in the ensemble. For regression problems, it is the answer.
@@ -118,7 +120,7 @@ CvGBTreesParams::CvGBTreesParams
.. ocv:function:: CvGBTreesParams::CvGBTreesParams( int loss_function_type, int weak_count, float shrinkage, float subsample_portion, int max_depth, bool use_surrogates )
:param loss_function_type: Type of the loss function used for training
(see :ref:`Training the GBT model`). It must be one of the
(see :ref:`Training GBT`). It must be one of the
following types: ``CvGBTrees::SQUARED_LOSS``, ``CvGBTrees::ABSOLUTE_LOSS``,
``CvGBTrees::HUBER_LOSS``, ``CvGBTrees::DEVIANCE_LOSS``. The first three
types are used for regression problems, and the last one for
@@ -128,7 +130,7 @@ CvGBTreesParams::CvGBTreesParams
count of trees in the GBT model, where ``K`` is the output classes count
(equal to one in case of a regression).
:param shrinkage: Regularization parameter (see :ref:`Training the GBT model`).
:param shrinkage: Regularization parameter (see :ref:`Training GBT`).
:param subsample_portion: Portion of the whole training set used for each algorithm iteration.
Subset is generated randomly. For more information see
@@ -222,13 +224,13 @@ Predicts a response for an input sample.
only one model.
:param k: Number of tree ensembles built in case of the classification problem
(see :ref:`Training the GBT model`). Use this
(see :ref:`Training GBT`). Use this
parameter to change the ouput to sum of the trees' predictions in the
``k``-th ensemble only. To get the total GBT model prediction, ``k`` value
must be -1. For regression problems, ``k`` is also equal to -1.
The method predicts the response corresponding to the given sample
(see :ref:`Predicting with the GBT model`).
(see :ref:`Predicting with GBT`).
The result is either the class label or the estimated function value. The
:ocv:func:`predict` method enables using the parallel version of the GBT model
prediction if the OpenCV is built with the TBB library. In this case, predictions
+1 -1
View File
@@ -71,7 +71,7 @@ so the error on the test set usually starts increasing after the network
size reaches a limit. Besides, the larger networks are trained much
longer than the smaller ones, so it is reasonable to pre-process the data,
using
:ocv:func:`PCA::operator ()` or similar technique, and train a smaller network
:ocv:func:`PCA::operator()` or similar technique, and train a smaller network
on only essential features.
Another MPL feature is an inability to handle categorical
+4 -16
View File
@@ -32,25 +32,13 @@ For the random trees usage example, please, see letter_recog.cpp sample in OpenC
**References:**
*
*Machine Learning*, Wald I, July 2002.
* *Machine Learning*, Wald I, July 2002. http://stat-www.berkeley.edu/users/breiman/wald2002-1.pdf
http://stat-www.berkeley.edu/users/breiman/wald2002-1.pdf
* *Looking Inside the Black Box*, Wald II, July 2002. http://stat-www.berkeley.edu/users/breiman/wald2002-2.pdf
*
*Looking Inside the Black Box*, Wald II, July 2002.
* *Software for the Masses*, Wald III, July 2002. http://stat-www.berkeley.edu/users/breiman/wald2002-3.pdf
http://stat-www.berkeley.edu/users/breiman/wald2002-2.pdf
*
*Software for the Masses*, Wald III, July 2002.
http://stat-www.berkeley.edu/users/breiman/wald2002-3.pdf
*
And other articles from the web site
http://www.stat.berkeley.edu/users/breiman/RandomForests/cc_home.htm
.
* And other articles from the web site http://www.stat.berkeley.edu/users/breiman/RandomForests/cc_home.htm
CvRTParams
----------