Skip to content

Instantly share code, notes, and snippets.

@lethalbrains
Created August 8, 2018 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lethalbrains/377362ef7b182c96e189da0662ac23b9 to your computer and use it in GitHub Desktop.
Save lethalbrains/377362ef7b182c96e189da0662ac23b9 to your computer and use it in GitHub Desktop.
def predict(self, data):
return np.array([self.__flow_data_thru_tree(row) for _, row in data.iterrows()])
def __flow_data_thru_tree(self, row):
if self.is_leaf_node: return self.probability
tree = self.left if row[self.split_feature] <= self.criteria else self.right
return tree.__flow_data_thru_tree(row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment