Skip to content

Commit da7a60b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c1fa49e commit da7a60b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

machine_learning/decision_tree.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def train(self, x, y):
9292
if len(x) < 2 * self.min_leaf_size or self.depth == 1:
9393
self.prediction = mean_y
9494
return
95-
95+
9696
best_split = 0
9797
min_error = self.mean_squared_error(x, mean_y) * 2
9898

@@ -105,16 +105,16 @@ def train(self, x, y):
105105
for i in range(len(x)):
106106
if len(x[:i]) < self.min_leaf_size or len(x[i:]) < self.min_leaf_size:
107107
continue
108-
108+
109109
left_y = y[:i]
110110
right_y = y[i:]
111111
mean_left = np.mean(left_y)
112112
mean_right = np.mean(right_y)
113-
113+
114114
error_left = self.mean_squared_error(left_y, mean_left)
115115
error_right = self.mean_squared_error(right_y, mean_right)
116116
error = error_left + error_right
117-
117+
118118
if error < min_error:
119119
best_split = i
120120
min_error = error

0 commit comments

Comments
 (0)