Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
e20d570e
Commit
e20d570e
authored
Jun 15, 2011
by
P. Druzhkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
brief gbt documentation added. some sample fixes made. code updated.
parent
9c071c6a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
8 deletions
+41
-8
gradient_boosted_trees.rst
modules/ml/doc/gradient_boosted_trees.rst
+0
-0
ml.rst
modules/ml/doc/ml.rst
+1
-1
ml.hpp
modules/ml/include/opencv2/ml/ml.hpp
+36
-6
gbt.cpp
modules/ml/src/gbt.cpp
+0
-0
tree_engine.cpp
samples/c/tree_engine.cpp
+4
-1
No files found.
modules/ml/doc/gradient_boosted_trees.rst
0 → 100644
View file @
e20d570e
This diff is collapsed.
Click to expand it.
modules/ml/doc/ml.rst
View file @
e20d570e
...
...
@@ -15,7 +15,7 @@ Most of the classification and regression algorithms are implemented as C++ clas
support_vector_machines
decision_trees
boosting
gradient_boosted_trees
random_trees
expectation_maximization
neural_networks
modules/ml/include/opencv2/ml/ml.hpp
View file @
e20d570e
...
...
@@ -1571,7 +1571,7 @@ public:
// Response value prediction
//
// API
// virtual float predict( const CvMat* sample, const CvMat* missing=0,
// virtual float predict
_serial
( const CvMat* sample, const CvMat* missing=0,
CvMat* weak_responses=0, CvSlice slice = CV_WHOLE_SEQ,
int k=-1 ) const;
...
...
@@ -1594,12 +1594,44 @@ public:
// RESULT
// Predicted value.
*/
virtual
float
predict_serial
(
const
CvMat
*
sample
,
const
CvMat
*
missing
=
0
,
CvMat
*
weakResponses
=
0
,
CvSlice
slice
=
CV_WHOLE_SEQ
,
int
k
=-
1
)
const
;
/*
// Response value prediction.
// Parallel version (in the case of TBB existence)
//
// API
// virtual float predict( const CvMat* sample, const CvMat* missing=0,
CvMat* weak_responses=0, CvSlice slice = CV_WHOLE_SEQ,
int k=-1 ) const;
// INPUT
// sample - input sample of the same type as in the training set.
// missing - missing values mask. missing=0 if there are no
// missing values in sample vector.
// weak_responses - predictions of all of the trees.
// not implemented (!)
// slice - part of the ensemble used for prediction.
// slice = CV_WHOLE_SEQ when all trees are used.
// k - number of ensemble used.
// k is in {-1,0,1,..,<count of output classes-1>}.
// in the case of classification problem
// <count of output classes-1> ensembles are built.
// If k = -1 ordinary prediction is the result,
// otherwise function gives the prediction of the
// k-th ensemble only.
// OUTPUT
// RESULT
// Predicted value.
*/
virtual
float
predict
(
const
CvMat
*
sample
,
const
CvMat
*
missing
=
0
,
CvMat
*
weakResponses
=
0
,
CvSlice
slice
=
CV_WHOLE_SEQ
,
int
k
=-
1
)
const
;
/*
// Delete
all temporary
data.
// Delete
s all the
data.
//
// API
// virtual void clear();
...
...
@@ -1607,7 +1639,7 @@ public:
// INPUT
// OUTPUT
// delete data, weak, orig_response, sum_response,
// weak_eval, ubsample_train, subsample_test,
// weak_eval,
s
ubsample_train, subsample_test,
// sample_idx, missing, lass_labels
// delta = 0.0
// RESULT
...
...
@@ -1623,7 +1655,7 @@ public:
//
// INPUT
// data - dataset
// type - defines which error is to compute
^
train (CV_TRAIN_ERROR) or
// type - defines which error is to compute
:
train (CV_TRAIN_ERROR) or
// test (CV_TEST_ERROR).
// OUTPUT
// resp - vector of predicitons
...
...
@@ -1633,7 +1665,6 @@ public:
virtual
float
calc_error
(
CvMLData
*
_data
,
int
type
,
std
::
vector
<
float
>
*
resp
=
0
);
/*
//
// Write parameters of the gtb model and data. Write learned model.
...
...
@@ -1852,7 +1883,6 @@ protected:
CvMat
*
orig_response
;
CvMat
*
sum_response
;
CvMat
*
sum_response_tmp
;
CvMat
*
weak_eval
;
CvMat
*
sample_idx
;
CvMat
*
subsample_train
;
CvMat
*
subsample_test
;
...
...
modules/ml/src/gbt.cpp
View file @
e20d570e
This diff is collapsed.
Click to expand it.
samples/c/tree_engine.cpp
View file @
e20d570e
...
...
@@ -125,7 +125,10 @@ int main(int argc, char** argv)
print_result
(
ertrees
.
calc_error
(
&
data
,
CV_TRAIN_ERROR
),
ertrees
.
calc_error
(
&
data
,
CV_TEST_ERROR
),
ertrees
.
get_var_importance
()
);
printf
(
"======GBTREES=====
\n
"
);
gbtrees
.
train
(
&
data
,
CvGBTreesParams
(
CvGBTrees
::
DEVIANCE_LOSS
,
100
,
0.05
f
,
0.6
f
,
10
,
true
));
if
(
categorical_response
)
gbtrees
.
train
(
&
data
,
CvGBTreesParams
(
CvGBTrees
::
DEVIANCE_LOSS
,
100
,
0.1
f
,
0.8
f
,
5
,
false
));
else
gbtrees
.
train
(
&
data
,
CvGBTreesParams
(
CvGBTrees
::
SQUARED_LOSS
,
100
,
0.1
f
,
0.8
f
,
5
,
false
));
print_result
(
gbtrees
.
calc_error
(
&
data
,
CV_TRAIN_ERROR
),
gbtrees
.
calc_error
(
&
data
,
CV_TEST_ERROR
),
0
);
//doesn't compute importance
}
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment