[TREE] Remove gap constraint, make tree construction more robust
This commit is contained in:
parent
c36195795a
commit
2f2080a337
@ -62,9 +62,7 @@ struct bst_gpair {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief small eps gap for minimum split decision. */
|
/*! \brief small eps gap for minimum split decision. */
|
||||||
const float rt_eps = 1e-5f;
|
const float rt_eps = 1e-6f;
|
||||||
/*! \brief min gap between feature values to allow a split happen */
|
|
||||||
const float rt_2eps = rt_eps * 2.0f;
|
|
||||||
|
|
||||||
/*! \brief define unsigned long for openmp loop */
|
/*! \brief define unsigned long for openmp loop */
|
||||||
typedef dmlc::omp_ulong omp_ulong;
|
typedef dmlc::omp_ulong omp_ulong;
|
||||||
|
|||||||
@ -291,7 +291,7 @@ class ColMaker: public TreeUpdater {
|
|||||||
ThreadEntry &e = stemp[tid][nid];
|
ThreadEntry &e = stemp[tid][nid];
|
||||||
float fsplit;
|
float fsplit;
|
||||||
if (tid != 0) {
|
if (tid != 0) {
|
||||||
if (std::abs(stemp[tid - 1][nid].last_fvalue - e.first_fvalue) > rt_2eps) {
|
if (stemp[tid - 1][nid].last_fvalue != e.first_fvalue) {
|
||||||
fsplit = (stemp[tid - 1][nid].last_fvalue + e.first_fvalue) * 0.5f;
|
fsplit = (stemp[tid - 1][nid].last_fvalue + e.first_fvalue) * 0.5f;
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
@ -352,7 +352,7 @@ class ColMaker: public TreeUpdater {
|
|||||||
e.first_fvalue = fvalue;
|
e.first_fvalue = fvalue;
|
||||||
} else {
|
} else {
|
||||||
// forward default right
|
// forward default right
|
||||||
if (std::abs(fvalue - e.first_fvalue) > rt_2eps) {
|
if (fvalue != e.first_fvalue) {
|
||||||
if (need_forward) {
|
if (need_forward) {
|
||||||
c.SetSubstract(snode[nid].stats, e.stats);
|
c.SetSubstract(snode[nid].stats, e.stats);
|
||||||
if (c.sum_hess >= param.min_child_weight &&
|
if (c.sum_hess >= param.min_child_weight &&
|
||||||
@ -393,7 +393,7 @@ class ColMaker: public TreeUpdater {
|
|||||||
e.last_fvalue = fvalue;
|
e.last_fvalue = fvalue;
|
||||||
} else {
|
} else {
|
||||||
// try to find a split
|
// try to find a split
|
||||||
if (std::abs(fvalue - e.last_fvalue) > rt_2eps &&
|
if (fvalue != e.last_fvalue &&
|
||||||
e.stats.sum_hess >= param.min_child_weight) {
|
e.stats.sum_hess >= param.min_child_weight) {
|
||||||
c.SetSubstract(snode[nid].stats, e.stats);
|
c.SetSubstract(snode[nid].stats, e.stats);
|
||||||
if (c.sum_hess >= param.min_child_weight) {
|
if (c.sum_hess >= param.min_child_weight) {
|
||||||
@ -511,7 +511,7 @@ class ColMaker: public TreeUpdater {
|
|||||||
e.last_fvalue = fvalue;
|
e.last_fvalue = fvalue;
|
||||||
} else {
|
} else {
|
||||||
// try to find a split
|
// try to find a split
|
||||||
if (std::abs(fvalue - e.last_fvalue) > rt_2eps &&
|
if (fvalue != e.last_fvalue &&
|
||||||
e.stats.sum_hess >= param.min_child_weight) {
|
e.stats.sum_hess >= param.min_child_weight) {
|
||||||
c.SetSubstract(snode[nid].stats, e.stats);
|
c.SetSubstract(snode[nid].stats, e.stats);
|
||||||
if (c.sum_hess >= param.min_child_weight) {
|
if (c.sum_hess >= param.min_child_weight) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user