private TreeNodeVisitor walkCorruptedPath ( TreeLearner model , DataPoint dp , int j , Random rand ) { TreeNodeVisitor curNode = model . getTreeNodeVisitor ( ) ; while ( ! curNode . isLeaf ( ) ) { int path = curNode . getPath ( dp ) ; int numChild = curNode . childrenCount ( ) ; if ( curNode . featuresUsed ( ) . contains ( j ) ) //corrupt the feature! { //this gets us a random OTHER path, wont be the same b/c we would need to wrap around 1 farther path = ( path + rand . nextInt ( numChild ) ) % numChild ; } if ( curNode . isPathDisabled ( path ) ) break ; else curNode = curNode . getChild ( path ) ; } return curNode ; }
walks the tree down to a leaf node adding corruption for a specific feature