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
518ed294
Commit
518ed294
authored
Feb 28, 2011
by
Gary Bradski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed a bug in boost.calc_error and added more documentation
parent
3dc7a67f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
tree_engine.cpp
samples/c/tree_engine.cpp
+9
-9
No files found.
samples/c/tree_engine.cpp
View file @
518ed294
...
...
@@ -10,8 +10,8 @@ void help()
"CvRTrees rtrees;
\n
"
"CvERTrees ertrees;
\n
"
"CvGBTrees gbtrees;
\n
"
"Date is hard coded to come from filename =
\"
../../../
OpenCV
/samples/c/waveform.data
\"
;
\n
"
"Or can come from filename =
\"
../../../
OpenCV
/samples/c/waveform.data
\"
;
\n
"
"Date is hard coded to come from filename =
\"
../../../
opencv
/samples/c/waveform.data
\"
;
\n
"
"Or can come from filename =
\"
../../../
opencv
/samples/c/waveform.data
\"
;
\n
"
"Call:
\n
"
"./tree_engine
\n\n
"
);
}
...
...
@@ -38,13 +38,13 @@ int main()
{
const
int
train_sample_count
=
300
;
//#define LEPIOTA
#ifdef LEPIOTA
const
char
*
filename
=
"../../
../OpenCV
/samples/c/agaricus-lepiota.data"
;
#define LEPIOTA //Turn on discrete data set
#ifdef LEPIOTA
//Of course, you might have to set the path here to what's on your machine ...
const
char
*
filename
=
"../../
opencv
/samples/c/agaricus-lepiota.data"
;
#else
const
char
*
filename
=
"../../
../OpenCV
/samples/c/waveform.data"
;
const
char
*
filename
=
"../../
opencv
/samples/c/waveform.data"
;
#endif
printf
(
"
\n
Reading in %s. If it is not found, you may have to change this hard-coded path in tree_engine.cpp
\n\n
"
,
filename
);
CvDTree
dtree
;
CvBoost
boost
;
CvRTrees
rtrees
;
...
...
@@ -74,7 +74,7 @@ int main()
#ifdef LEPIOTA
printf
(
"======BOOST=====
\n
"
);
boost
.
train
(
&
data
,
CvBoostParams
(
CvBoost
::
DISCRETE
,
100
,
0.95
,
2
,
false
,
0
));
print_result
(
boost
.
calc_error
(
&
data
,
CV_TRAIN_ERROR
),
boost
.
calc_error
(
&
data
),
0
);
print_result
(
boost
.
calc_error
(
&
data
,
CV_TRAIN_ERROR
),
boost
.
calc_error
(
&
data
,
CV_TEST_ERROR
),
0
);
//doesn't compute importance
#endif
printf
(
"======RTREES=====
\n
"
);
...
...
@@ -87,7 +87,7 @@ int main()
printf
(
"======GBTREES=====
\n
"
);
gbtrees
.
train
(
&
data
,
CvGBTreesParams
(
CvGBTrees
::
DEVIANCE_LOSS
,
100
,
0.05
f
,
0.6
f
,
10
,
true
));
print_result
(
gbtrees
.
calc_error
(
&
data
,
CV_TRAIN_ERROR
),
gbtrees
.
calc_error
(
&
data
,
CV_TEST_ERROR
),
0
);
print_result
(
gbtrees
.
calc_error
(
&
data
,
CV_TRAIN_ERROR
),
gbtrees
.
calc_error
(
&
data
,
CV_TEST_ERROR
),
0
);
//doesn't compute importance
}
else
printf
(
"File can not be read"
);
...
...
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