[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-10-23 15:25:53 +00:00
parent 38764378d4
commit c76784e708

View File

@ -3,11 +3,12 @@ import pandas as pd
class RidgeRegression:
def __init__(self,
alpha: float = 0.001,
regularization_param: float = 0.1,
num_iterations: int = 1000,
) -> None:
def __init__(
self,
alpha: float = 0.001,
regularization_param: float = 0.1,
num_iterations: int = 1000,
) -> None:
self.alpha: float = alpha
self.regularization_param: float = regularization_param
self.num_iterations: int = num_iterations
@ -49,10 +50,9 @@ class RidgeRegression:
m = len(y)
predictions = x_scaled.dot(self.theta)
cost = (
1 / (2 * m)) * np.sum((predictions - y) ** 2) + (
self.regularization_param / (2 * m)
) * np.sum(self.theta**2)
cost = (1 / (2 * m)) * np.sum((predictions - y) ** 2) + (
self.regularization_param / (2 * m)
) * np.sum(self.theta**2)
return cost
def mean_absolute_error(self, y_true: np.ndarray, y_pred: np.ndarray) -> float: