diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2020-09-18 09:09:59 +0200 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2020-09-18 09:09:59 +0200 |
| commit | 4485f76727be2e7271a25ca84db9ff96fd69a9d7 (patch) | |
| tree | 10ed1d34fb68f46c39c2c57203de8e1432aa10e1 | |
| parent | 736ef1bb41a821fbaa0fae2a07fed188897580b4 (diff) | |
Minor: improved stop condition for tree.predict
| -rw-r--r-- | assignment1.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/assignment1.py b/assignment1.py index 00432ec..ac3b7ec 100644 --- a/assignment1.py +++ b/assignment1.py @@ -51,7 +51,7 @@ class Node: def is_leaf_node(self, node_classes): """ - is_leaf_node is used to change the col attribute to zero to indicate a + is_leaf_node is used to change the col attribute to None to indicate a leaf node """ self.col = None @@ -84,7 +84,7 @@ class Tree: # De index van de row van x die we in de boom willen droppen drop = 0 - while not set(nodes).issubset({0, 1}): + while not all(pred_class in {0,1} for pred_class in nodes): # Als de col None is dan is het een leaf node, dus dan is de row # van x hier beland if nodes[drop].col is None: |
