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