change things back
This commit is contained in:
parent
b708f3f029
commit
3e9f8bfac9
@ -115,7 +115,6 @@ struct EvalCTest: public IEvaluator {
|
|||||||
utils::Check(preds.size() % info.labels.size() == 0,
|
utils::Check(preds.size() % info.labels.size() == 0,
|
||||||
"label and prediction size not match");
|
"label and prediction size not match");
|
||||||
size_t ngroup = preds.size() / info.labels.size() - 1;
|
size_t ngroup = preds.size() / info.labels.size() - 1;
|
||||||
ngroup = 1;
|
|
||||||
const unsigned ndata = static_cast<unsigned>(info.labels.size());
|
const unsigned ndata = static_cast<unsigned>(info.labels.size());
|
||||||
utils::Check(ngroup > 1, "pred size does not meet requirement");
|
utils::Check(ngroup > 1, "pred size does not meet requirement");
|
||||||
utils::Check(ndata == info.info.fold_index.size(), "need fold index");
|
utils::Check(ndata == info.info.fold_index.size(), "need fold index");
|
||||||
|
|||||||
@ -288,6 +288,9 @@ class TreeModel {
|
|||||||
"TreeModel: wrong format");
|
"TreeModel: wrong format");
|
||||||
utils::Check(fi.Read(&stats[0], sizeof(NodeStat) * stats.size()) > 0,
|
utils::Check(fi.Read(&stats[0], sizeof(NodeStat) * stats.size()) > 0,
|
||||||
"TreeModel: wrong format");
|
"TreeModel: wrong format");
|
||||||
|
if (param.size_leaf_vector != 0) {
|
||||||
|
utils::Check(fi.Read(&leaf_vector), "TreeModel: wrong format");
|
||||||
|
}
|
||||||
// chg deleted nodes
|
// chg deleted nodes
|
||||||
deleted_nodes.resize(0);
|
deleted_nodes.resize(0);
|
||||||
for (int i = param.num_roots; i < param.num_nodes; i ++) {
|
for (int i = param.num_roots; i < param.num_nodes; i ++) {
|
||||||
@ -308,6 +311,7 @@ class TreeModel {
|
|||||||
fo.Write(¶m, sizeof(Param));
|
fo.Write(¶m, sizeof(Param));
|
||||||
fo.Write(&nodes[0], sizeof(Node) * nodes.size());
|
fo.Write(&nodes[0], sizeof(Node) * nodes.size());
|
||||||
fo.Write(&stats[0], sizeof(NodeStat) * nodes.size());
|
fo.Write(&stats[0], sizeof(NodeStat) * nodes.size());
|
||||||
|
if (param.size_leaf_vector != 0) fo.Write(leaf_vector);
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
* \brief add child nodes to node
|
* \brief add child nodes to node
|
||||||
|
|||||||
@ -244,7 +244,6 @@ struct CVGradStats : public GradStats {
|
|||||||
}
|
}
|
||||||
/*! \brief calculate gain of the solution */
|
/*! \brief calculate gain of the solution */
|
||||||
inline double CalcGain(const TrainParam ¶m) const {
|
inline double CalcGain(const TrainParam ¶m) const {
|
||||||
return param.CalcGain(train[0].sum_grad, train[0].sum_hess);
|
|
||||||
double ret = 0.0;
|
double ret = 0.0;
|
||||||
for (unsigned i = 0; i < vsize; ++i) {
|
for (unsigned i = 0; i < vsize; ++i) {
|
||||||
ret += param.CalcGain(train[i].sum_grad,
|
ret += param.CalcGain(train[i].sum_grad,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user