We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d7e2e14 commit 0d268b3Copy full SHA for 0d268b3
supervised_class/dt.py
@@ -25,10 +25,12 @@ def entropy(y):
25
26
27
class TreeNode:
28
- def __init__(self, depth=0, max_depth=None):
29
- # print 'depth:', depth
+ def __init__(self, depth=1, max_depth=None):
+ print('depth:', depth)
30
self.depth = depth
31
self.max_depth = max_depth
32
+ if self.max_depth is not None and self.max_depth < self.depth:
33
+ raise Exception("depth > max_depth")
34
35
def fit(self, X, Y):
36
if len(Y) == 1 or len(set(Y)) == 1:
0 commit comments