mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-04-07 06:15:55 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
5bf9b854b4
commit
85020a76c2
@ -16,7 +16,9 @@ class RidgeRegression:
|
|||||||
self.alpha = alpha
|
self.alpha = alpha
|
||||||
self.lambda_ = lambda_
|
self.lambda_ = lambda_
|
||||||
self.iterations = iterations
|
self.iterations = iterations
|
||||||
self.theta: Optional[np.ndarray] = None # Initialize as None, later will be ndarray
|
self.theta: Optional[np.ndarray] = (
|
||||||
|
None # Initialize as None, later will be ndarray
|
||||||
|
)
|
||||||
|
|
||||||
def feature_scaling(
|
def feature_scaling(
|
||||||
self, features: np.ndarray
|
self, features: np.ndarray
|
||||||
@ -95,7 +97,7 @@ class RidgeRegression:
|
|||||||
"""
|
"""
|
||||||
if self.theta is None:
|
if self.theta is None:
|
||||||
raise ValueError("Model is not trained yet. Call the `fit` method first.")
|
raise ValueError("Model is not trained yet. Call the `fit` method first.")
|
||||||
|
|
||||||
features_scaled, _, _ = self.feature_scaling(
|
features_scaled, _, _ = self.feature_scaling(
|
||||||
features
|
features
|
||||||
) # Scale features using training data
|
) # Scale features using training data
|
||||||
@ -120,7 +122,7 @@ class RidgeRegression:
|
|||||||
"""
|
"""
|
||||||
if self.theta is None:
|
if self.theta is None:
|
||||||
raise ValueError("Model is not trained yet. Call the `fit` method first.")
|
raise ValueError("Model is not trained yet. Call the `fit` method first.")
|
||||||
|
|
||||||
features_scaled, _, _ = self.feature_scaling(
|
features_scaled, _, _ = self.feature_scaling(
|
||||||
features
|
features
|
||||||
) # Scale features using training data
|
) # Scale features using training data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user