Guest User

Untitled

a guest
Oct 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. class node():
  2. def __init__(self):
  3. self.split_atrr = None
  4. self.split_thres = None
  5. self.left_child = None
  6. self.right_child = None
  7. def get_name(self):
  8. return 'Node'
  9. class leaf():
  10. def __init__(self):
  11. self.label = None
  12. def get_nmae(self):
  13. return 'leaf'
  14.  
  15. class decision_tree():
  16. def __init__(self):
  17. self.root = None
  18. def fit(self, x, y):
  19. self.spliter(x,y,self.root)
  20. return 0
  21. def spliter(self,x,y,tree)
  22. tree = node() #this does not make self.root as a node
  23. spliter(x,y,tree.left_child) #this line does not work unless I change the __init__ to "self.root = node()"
  24. # Wish to recursively expand the tree.
  25. #However, return error saying tree.left_child is none type
Add Comment
Please, Sign In to add comment