Skip to content

Commit 1629c4c

Browse files
Update machine_learning/linear_regression.py
Co-authored-by: Tianyi Zheng <[email protected]>
1 parent 29fb882 commit 1629c4c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

machine_learning/linear_regression.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def ols_linear_regression(data_x: np.ndarray, data_y: np.ndarray) -> np.ndarray:
4141
data_x = np.c_[np.ones(data_x.shape[0]), data_x].astype(float)
4242

4343
# Use NumPy's built-in function to solve the linear regression problem
44-
theta = np.linalg.inv(data_x.T.dot(data_x)).dot(data_x.T).dot(data_y)
44+
theta = np.linalg.inv(data_x.T @ data_x) @ data_x.T @ data_y
4545

4646
return theta
4747

0 commit comments

Comments
 (0)