Fixes for multiple and default metric (#1239)

* fix multiple evaluation metrics

* create DefaultEvalMetric only when really necessary

* py test for #1239

* make travis happy
This commit is contained in:
Vadim Khotilovich
2016-06-05 00:17:35 -05:00
committed by Tianqi Chen
parent 9ef86072f4
commit 9a48a40cf1
3 changed files with 17 additions and 7 deletions

View File

@@ -33,7 +33,10 @@ class Booster {
inline void SetParam(const std::string& name, const std::string& val) {
auto it = std::find_if(cfg_.begin(), cfg_.end(),
[&name](decltype(*cfg_.begin()) &x) {
[&name, &val](decltype(*cfg_.begin()) &x) {
if (name == "eval_metric") {
return x.first == name && x.second == val;
}
return x.first == name;
});
if (it == cfg_.end()) {