From 0461231d3de803db65c8d3ff4c7b3bdb9c7350e8 Mon Sep 17 00:00:00 2001 From: tqchen Date: Mon, 20 Apr 2015 16:21:55 +0000 Subject: [PATCH] more capacity for base --- src/tree/updater_basemaker-inl.hpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/tree/updater_basemaker-inl.hpp b/src/tree/updater_basemaker-inl.hpp index 75683a68d..1f1d33c77 100644 --- a/src/tree/updater_basemaker-inl.hpp +++ b/src/tree/updater_basemaker-inl.hpp @@ -304,16 +304,16 @@ class BaseMaker: public IUpdater { } } } - /*! \brief common helper data structure to build sketch*/ + /*! \brief common helper data structure to build sketch */ struct SketchEntry { /*! \brief total sum of amount to be met */ - bst_float sum_total; + double sum_total; /*! \brief statistics used in the sketch */ - bst_float rmin, wmin; + double rmin, wmin; /*! \brief last seen feature value */ bst_float last_fvalue; /*! \brief current size of sketch */ - bst_float next_goal; + double next_goal; // pointer to the sketch to put things in utils::WXQuantileSketch *sketch; // initialize the space @@ -337,8 +337,8 @@ class BaseMaker: public IUpdater { return; } if (last_fvalue != fvalue) { - bst_float rmax = rmin + wmin; - if (rmax >= next_goal) { + double rmax = rmin + wmin; + if (rmax >= next_goal && sketch->temp.size != max_size) { if (sketch->temp.size == 0 || last_fvalue > sketch->temp.data[sketch->temp.size-1].value) { // push to sketch sketch->temp.data[sketch->temp.size] = @@ -350,11 +350,16 @@ class BaseMaker: public IUpdater { ++sketch->temp.size; } if (sketch->temp.size == max_size) { - next_goal = sum_total * 2.0f + 1e-5f; + next_goal = sum_total * 2.0f + 1e-5f; } else{ next_goal = static_cast(sketch->temp.size * sum_total / max_size); } - } + } else { + if (rmax >= next_goal) { + rabit::TrackerPrintf("INFO: rmax=%g, sum_total=%g, next_goal=%g, size=%lu\n", + rmax, sum_total, next_goal, sketch->temp.size); + } + } rmin = rmax; wmin = w; last_fvalue = fvalue; @@ -364,7 +369,7 @@ class BaseMaker: public IUpdater { } /*! \brief push final unfinished value to the sketch */ inline void Finalize(unsigned max_size) { - bst_float rmax = rmin + wmin; + double rmax = rmin + wmin; if (sketch->temp.size == 0 || last_fvalue > sketch->temp.data[sketch->temp.size-1].value) { utils::Assert(sketch->temp.size <= max_size, "Finalize: invalid maximum size, max_size=%u, stemp.size=%lu",