Created
May 10, 2018 12:24
-
-
Save lyqscmy/f12bfbdda969bf08d06ed7487e4f0228 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl XGBTree { | |
fn get_leaf_index(&self, feats: &FVec) -> usize { | |
let mut nid: usize = 0; | |
let mut node = &self.nodes[nid]; | |
while !node.is_leaf() { | |
let split_index = node.split_index(); | |
if feats.is_misssing(split_index) { | |
nid = node.cdefault(); | |
} else { | |
let split_cond = node.split_cond(); | |
if feats.fvalue(split_index) < split_cond { | |
nid = node.cleft(); | |
} else { | |
nid = node.cright(); | |
} | |
} | |
node = &self.nodes[nid]; | |
} | |
return nid; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment