avoid collecting duplicate parameters in Booster::cfg_
This commit is contained in:
parent
b3c9e6a0db
commit
0527b17c9d
@ -32,7 +32,16 @@ class Booster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void SetParam(const std::string& name, const std::string& val) {
|
inline void SetParam(const std::string& name, const std::string& val) {
|
||||||
cfg_.push_back(std::make_pair(name, val));
|
auto it = std::find_if(cfg_.begin(), cfg_.end(),
|
||||||
|
[&name](decltype(*cfg_.begin()) &x) {
|
||||||
|
return x.first == name;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (it == cfg_.end()) {
|
||||||
|
cfg_.push_back(std::make_pair(name, val));
|
||||||
|
} else {
|
||||||
|
(*it).second = val;
|
||||||
|
}
|
||||||
if (configured_) {
|
if (configured_) {
|
||||||
learner_->Configure(cfg_);
|
learner_->Configure(cfg_);
|
||||||
}
|
}
|
||||||
@ -277,7 +286,7 @@ int XGDMatrixCreateFromCSC(const bst_ulong* col_ptr,
|
|||||||
RowBatch::Entry(static_cast<bst_uint>(i), data[j]),
|
RowBatch::Entry(static_cast<bst_uint>(i), data[j]),
|
||||||
tid);
|
tid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mat.info.num_row = mat.row_ptr_.size() - 1;
|
mat.info.num_row = mat.row_ptr_.size() - 1;
|
||||||
mat.info.num_col = static_cast<uint64_t>(ncol);
|
mat.info.num_col = static_cast<uint64_t>(ncol);
|
||||||
mat.info.num_nonzero = nelem;
|
mat.info.num_nonzero = nelem;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user