You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by ri...@apache.org on 2017/10/23 17:31:25 UTC
madlib git commit: DT: Assert stats index only when it's used
Repository: madlib
Updated Branches:
refs/heads/master a32c01c0b -> 2c01ec971
DT: Assert stats index only when it's used
The stats_i >= 0 assert is true only when the feature_index is valid
(i.e. the node is not terminated). The assert fails when checked before
the feature_indices check, hence moving it within the if statement.
This is also recommended since stats_i is only used within that 'if'
block.
Project: http://git-wip-us.apache.org/repos/asf/madlib/repo
Commit: http://git-wip-us.apache.org/repos/asf/madlib/commit/2c01ec97
Tree: http://git-wip-us.apache.org/repos/asf/madlib/tree/2c01ec97
Diff: http://git-wip-us.apache.org/repos/asf/madlib/diff/2c01ec97
Branch: refs/heads/master
Commit: 2c01ec971ff2affddec6bea940f4dfcd8985c685
Parents: a32c01c
Author: Rahul Iyer <ri...@apache.org>
Authored: Mon Oct 23 10:26:42 2017 -0700
Committer: Rahul Iyer <ri...@apache.org>
Committed: Mon Oct 23 10:26:42 2017 -0700
----------------------------------------------------------------------
src/modules/recursive_partitioning/DT_impl.hpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/madlib/blob/2c01ec97/src/modules/recursive_partitioning/DT_impl.hpp
----------------------------------------------------------------------
diff --git a/src/modules/recursive_partitioning/DT_impl.hpp b/src/modules/recursive_partitioning/DT_impl.hpp
index 808e48c..cae3f5b 100644
--- a/src/modules/recursive_partitioning/DT_impl.hpp
+++ b/src/modules/recursive_partitioning/DT_impl.hpp
@@ -661,10 +661,11 @@ DecisionTree<Container>::pickSurrogates(
for (Index i=0; i < n_surr_nodes; i++){
Index curr_node = n_ancestors + i;
assert(curr_node >= 0 && curr_node < feature_indices.size());
- Index stats_i = static_cast<Index>(state.stats_lookup(i));
- assert(stats_i >= 0);
if (feature_indices(curr_node) >= 0){
+ Index stats_i = static_cast<Index>(state.stats_lookup(i));
+ assert(stats_i >= 0);
+
// 1. Compute the max count and corresponding split threshold for
// each categorical and continuous feature
ColumnVector cat_max_thres = ColumnVector::Zero(n_cats);