예제 #1
0
  /**
   * Retrieves nodes from root to leaf and returns leaf index.
   *
   * @param feat feature vector
   * @param root_id starting root index
   * @return leaf index
   */
  public int getLeafIndex(FVec feat, int root_id) {
    int pid = root_id;

    while (!nodes[pid].is_leaf()) {
      int split_index = nodes[pid].split_index();
      pid = getNext(pid, feat.fvalue(split_index));
    }

    return pid;
  }