more capacity for base

This commit is contained in:
tqchen 2015-04-20 16:21:55 +00:00
parent dfec406afd
commit 0461231d3d

View File

@ -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 { struct SketchEntry {
/*! \brief total sum of amount to be met */ /*! \brief total sum of amount to be met */
bst_float sum_total; double sum_total;
/*! \brief statistics used in the sketch */ /*! \brief statistics used in the sketch */
bst_float rmin, wmin; double rmin, wmin;
/*! \brief last seen feature value */ /*! \brief last seen feature value */
bst_float last_fvalue; bst_float last_fvalue;
/*! \brief current size of sketch */ /*! \brief current size of sketch */
bst_float next_goal; double next_goal;
// pointer to the sketch to put things in // pointer to the sketch to put things in
utils::WXQuantileSketch<bst_float, bst_float> *sketch; utils::WXQuantileSketch<bst_float, bst_float> *sketch;
// initialize the space // initialize the space
@ -337,8 +337,8 @@ class BaseMaker: public IUpdater {
return; return;
} }
if (last_fvalue != fvalue) { if (last_fvalue != fvalue) {
bst_float rmax = rmin + wmin; double rmax = rmin + wmin;
if (rmax >= next_goal) { if (rmax >= next_goal && sketch->temp.size != max_size) {
if (sketch->temp.size == 0 || last_fvalue > sketch->temp.data[sketch->temp.size-1].value) { if (sketch->temp.size == 0 || last_fvalue > sketch->temp.data[sketch->temp.size-1].value) {
// push to sketch // push to sketch
sketch->temp.data[sketch->temp.size] = sketch->temp.data[sketch->temp.size] =
@ -354,7 +354,12 @@ class BaseMaker: public IUpdater {
} else{ } else{
next_goal = static_cast<bst_float>(sketch->temp.size * sum_total / max_size); next_goal = static_cast<bst_float>(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; rmin = rmax;
wmin = w; wmin = w;
last_fvalue = fvalue; last_fvalue = fvalue;
@ -364,7 +369,7 @@ class BaseMaker: public IUpdater {
} }
/*! \brief push final unfinished value to the sketch */ /*! \brief push final unfinished value to the sketch */
inline void Finalize(unsigned max_size) { 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) { if (sketch->temp.size == 0 || last_fvalue > sketch->temp.data[sketch->temp.size-1].value) {
utils::Assert(sketch->temp.size <= max_size, utils::Assert(sketch->temp.size <= max_size,
"Finalize: invalid maximum size, max_size=%u, stemp.size=%lu", "Finalize: invalid maximum size, max_size=%u, stemp.size=%lu",