Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
dd3bf1f2
Commit
dd3bf1f2
authored
Jun 23, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the example to recommend using something like the f1-score when using
BOBYQA for model selection.
parent
505cc7b1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
model_selection_ex.cpp
examples/model_selection_ex.cpp
+6
-7
No files found.
examples/model_selection_ex.cpp
View file @
dd3bf1f2
...
...
@@ -77,13 +77,12 @@ public:
matrix
<
double
>
result
=
cross_validate_trainer
(
trainer
,
samples
,
labels
,
10
);
cout
<<
"gamma: "
<<
setw
(
11
)
<<
gamma
<<
" nu: "
<<
setw
(
11
)
<<
nu
<<
" cross validation accuracy: "
<<
result
;
// Here I'm just summing the accuracy on each class. However, you could do something else.
// For example, your application might require a 90% accuracy on class +1 and so you could
// heavily penalize results that didn't obtain the desired accuracy. Or similarly, you
// might use the roc_c1_trainer() function to adjust the trainer output so that it always
// obtained roughly a 90% accuracy on class +1. In that case returning the sum of the two
// class accuracies might be appropriate.
return
sum
(
result
);
// Here I'm returning the harmonic mean between the accuracies of each class.
// However, you could do something else. For example, you might care a lot more
// about correctly predicting the +1 class, so you could penalize results that
// didn't obtain a high accuracy on that class. You might do this by using
// something like a weighted version of the F1-score (see http://en.wikipedia.org/wiki/F1_score).
return
2
*
prod
(
result
)
/
sum
(
result
);
}
const
std
::
vector
<
sample_type
>&
samples
;
...
...
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