Skip to content

Commit eaca0d9

Browse files
pre-commit-ci[bot]Jeel Gajera
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent f8f63b1 commit eaca0d9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

machine_learning/ordinary_least_squares_regression.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ def ols_regression(x_point: np.ndarray, y_point: np.ndarray) -> tuple:
4444
y_mean = np.mean(y_point)
4545

4646
# Calculate the slope of the regression line.
47-
slope = np.sum((x_point - x_mean) * (y_point - y_mean)) / np.sum((x_point - x_mean) ** 2)
47+
slope = np.sum((x_point - x_mean) * (y_point - y_mean)) / np.sum(
48+
(x_point - x_mean) ** 2
49+
)
4850

4951
# Calculate the intercept of the regression line.
5052
intercept = y_mean - slope * x_mean

0 commit comments

Comments
 (0)