Skip to content

Commit 260f5a6

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

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

machine_learning/linear_regression_naive.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ def collect_dataset() -> np.ndarray:
4141

4242

4343
def run_steep_gradient_descent(
44-
data_x: np.ndarray, data_y: np.ndarray, len_data: int, alpha: float, theta: np.ndarray
44+
data_x: np.ndarray,
45+
data_y: np.ndarray,
46+
len_data: int,
47+
alpha: float,
48+
theta: np.ndarray,
4549
) -> np.ndarray:
4650
"""Run one step of steep gradient descent.
4751
@@ -70,10 +74,7 @@ def run_steep_gradient_descent(
7074

7175

7276
def sum_of_square_error(
73-
data_x: np.ndarray,
74-
data_y: np.ndarray,
75-
len_data: int,
76-
theta: np.ndarray
77+
data_x: np.ndarray, data_y: np.ndarray, len_data: int, theta: np.ndarray
7778
) -> float:
7879
"""Return sum of square error for error calculation.
7980
@@ -88,10 +89,7 @@ def sum_of_square_error(
8889
return float(error)
8990

9091

91-
def run_linear_regression(
92-
data_x: np.ndarray,
93-
data_y: np.ndarray
94-
) -> np.ndarray:
92+
def run_linear_regression(data_x: np.ndarray, data_y: np.ndarray) -> np.ndarray:
9593
"""Run linear regression using gradient descent.
9694
9795
:param data_x: dataset features
@@ -114,10 +112,7 @@ def run_linear_regression(
114112
return theta
115113

116114

117-
def mean_absolute_error(
118-
predicted_y: np.ndarray,
119-
original_y: np.ndarray
120-
) -> float:
115+
def mean_absolute_error(predicted_y: np.ndarray, original_y: np.ndarray) -> float:
121116
"""Return mean absolute error.
122117
123118
>>> predicted_y = np.array([3, -0.5, 2, 7])

0 commit comments

Comments
 (0)