Skip to content

Commit 85020a7

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

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

machine_learning/ridge_regression.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ def __init__(
1616
self.alpha = alpha
1717
self.lambda_ = lambda_
1818
self.iterations = iterations
19-
self.theta: Optional[np.ndarray] = None # Initialize as None, later will be ndarray
19+
self.theta: Optional[np.ndarray] = (
20+
None # Initialize as None, later will be ndarray
21+
)
2022

2123
def feature_scaling(
2224
self, features: np.ndarray
@@ -95,7 +97,7 @@ def predict(self, features: np.ndarray) -> np.ndarray:
9597
"""
9698
if self.theta is None:
9799
raise ValueError("Model is not trained yet. Call the `fit` method first.")
98-
100+
99101
features_scaled, _, _ = self.feature_scaling(
100102
features
101103
) # Scale features using training data
@@ -120,7 +122,7 @@ def compute_cost(self, features: np.ndarray, target: np.ndarray) -> float:
120122
"""
121123
if self.theta is None:
122124
raise ValueError("Model is not trained yet. Call the `fit` method first.")
123-
125+
124126
features_scaled, _, _ = self.feature_scaling(
125127
features
126128
) # Scale features using training data

0 commit comments

Comments
 (0)