Xiangrui Meng created SPARK-3086: ------------------------------------ Summary: Use 1-indexing for decision tree nodes Key: SPARK-3086 URL: https://issues.apache.org/jira/browse/SPARK-3086 Project: Spark Issue Type: Improvement Components: MLlib Reporter: Xiangrui Meng Priority: Minor
1-indexing is good for binary trees. The root node gets index 1. And for any node with index i, its left child is (i << 1), right child is (i << 1) + 1, parent is (i >> 1), and its level is `java.lang.Integer.highestOneBit(idx)` (also 1-indexing for levels). -- This message was sent by Atlassian JIRA (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org