Remove leaf vector, add tree serialisation test, fix Windows tests (#3989)

This commit is contained in:
Rory Mitchell
2018-12-13 10:28:38 +13:00
committed by GitHub
parent 84a3af8dc0
commit 3d81c48d3f
9 changed files with 95 additions and 36 deletions

View File

@@ -408,8 +408,6 @@ template <typename ParamT>
}
/*! \return whether the statistics is not used yet */
inline bool Empty() const { return sum_hess == 0.0; }
/*! \brief set leaf vector value based on statistics */
inline void SetLeafVec(const TrainParam& param, bst_float* vec) const {}
// constructor to allow inheritance
GradStats() = default;
/*! \brief add statistics to the data */

View File

@@ -130,7 +130,6 @@ class ColMaker: public TreeUpdater {
p_tree->Stat(nid).loss_chg = snode_[nid].best.loss_chg;
p_tree->Stat(nid).base_weight = snode_[nid].weight;
p_tree->Stat(nid).sum_hess = static_cast<float>(snode_[nid].stats.sum_hess);
snode_[nid].stats.SetLeafVec(param_, p_tree->Leafvec(nid));
}
}

View File

@@ -263,7 +263,6 @@ class HistMaker: public BaseMaker {
inline void SetStats(RegTree *p_tree, int nid, const TStats &node_sum) {
p_tree->Stat(nid).base_weight = static_cast<bst_float>(node_sum.CalcWeight(param_));
p_tree->Stat(nid).sum_hess = static_cast<bst_float>(node_sum.sum_hess);
node_sum.SetLeafVec(param_, p_tree->Leafvec(nid));
}
};

View File

@@ -203,7 +203,6 @@ void QuantileHistMaker::Builder::Update(const GHistIndexMatrix& gmat,
p_tree->Stat(nid).loss_chg = snode_[nid].best.loss_chg;
p_tree->Stat(nid).base_weight = snode_[nid].weight;
p_tree->Stat(nid).sum_hess = static_cast<float>(snode_[nid].stats.sum_hess);
snode_[nid].stats.SetLeafVec(param_, p_tree->Leafvec(nid));
}
pruner_->Update(gpair, p_fmat, std::vector<RegTree*>{p_tree});

View File

@@ -127,7 +127,6 @@ class TreeRefresher: public TreeUpdater {
RegTree &tree = *p_tree;
tree.Stat(nid).base_weight = static_cast<bst_float>(gstats[nid].CalcWeight(param_));
tree.Stat(nid).sum_hess = static_cast<bst_float>(gstats[nid].sum_hess);
gstats[nid].SetLeafVec(param_, tree.Leafvec(nid));
if (tree[nid].IsLeaf()) {
if (param_.refresh_leaf) {
tree[nid].SetLeaf(tree.Stat(nid).base_weight * param_.learning_rate);

View File

@@ -128,9 +128,6 @@ class SketchMaker: public BaseMaker {
inline static void Reduce(SKStats &a, const SKStats &b) { // NOLINT(*)
a.Add(b);
}
/*! \brief set leaf vector value based on statistics */
inline void SetLeafVec(const TrainParam &param, bst_float *vec) const {
}
};
inline void BuildSketch(const std::vector<GradientPair> &gpair,
DMatrix *p_fmat,
@@ -303,7 +300,6 @@ class SketchMaker: public BaseMaker {
inline void SetStats(int nid, const SKStats &node_sum, RegTree *p_tree) {
p_tree->Stat(nid).base_weight = static_cast<bst_float>(node_sum.CalcWeight(param_));
p_tree->Stat(nid).sum_hess = static_cast<bst_float>(node_sum.sum_hess);
node_sum.SetLeafVec(param_, p_tree->Leafvec(nid));
}
inline void EnumerateSplit(const WXQSketch::Summary &pos_grad,
const WXQSketch::Summary &neg_grad,