Commit dd3bf1f2 authored by Davis King's avatar Davis King

Changed the example to recommend using something like the f1-score when using

BOBYQA for model selection.
parent 505cc7b1
...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment