From 8ec10bba5e487750a7dbd5e82b60f2e5627b6e1c Mon Sep 17 00:00:00 2001 From: David Refaeli <32735496+DavidMeerkatRefaeli@users.noreply.github.com> Date: Fri, 30 Aug 2019 22:01:31 +0300 Subject: [PATCH 1/2] Use unique_vals function Beautiful code - just a small nitpick: you define unique_vals but don't actually use it. I replaced the relevant line in find_best_split function. --- decision_tree.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decision_tree.ipynb b/decision_tree.ipynb index 07da773..845c565 100644 --- a/decision_tree.ipynb +++ b/decision_tree.ipynb @@ -657,7 +657,7 @@ "\n", " for col in range(n_features): # for each feature\n", "\n", - " values = set([row[col] for row in rows]) # unique values in the column\n", + " values = unique_vals(rows, col) # unique values in the column\n", "\n", " for val in values: # for each value\n", "\n", From 8323496ec686bb4c410270a53f83b3d8e99ba547 Mon Sep 17 00:00:00 2001 From: David Refaeli <32735496+DavidMeerkatRefaeli@users.noreply.github.com> Date: Fri, 30 Aug 2019 22:07:25 +0300 Subject: [PATCH 2/2] apply to .py file --- decision_tree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decision_tree.py b/decision_tree.py index 495ac0a..572c0e8 100644 --- a/decision_tree.py +++ b/decision_tree.py @@ -231,7 +231,7 @@ def find_best_split(rows): for col in range(n_features): # for each feature - values = set([row[col] for row in rows]) # unique values in the column + values = unique_vals(rows, col) # unique values in the column for val in values: # for each value