Skip to content

Commit

Permalink
Format using black
Browse files Browse the repository at this point in the history
  • Loading branch information
Haleshot committed Aug 18, 2024
1 parent 98eeef2 commit e3755b1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np


# # Step 1:
def ridge_loss(X: np.ndarray, w: np.ndarray, y_true: np.ndarray, alpha: float) -> float:
y_pred = []
Expand All @@ -9,7 +10,7 @@ def ridge_loss(X: np.ndarray, w: np.ndarray, y_true: np.ndarray, alpha: float) -
temp += X[i][j] * w[j]
y_pred.append(temp)
# y_pred[i] += [i for i in y_pred]

# print(X @ w)
MSE = sum((((y_true - y_pred) ** 2) / len(X)).tolist())
sum_w = sum([i**2 for i in w])
Expand All @@ -28,7 +29,6 @@ def ridge_loss(X: np.ndarray, w: np.ndarray, y_true: np.ndarray, alpha: float) -
# return MSE + reg



X = np.array([[1, 1], [2, 1], [3, 1], [4, 1]])
w = np.array([0.2, 2])
y_true = np.array([2, 3, 4, 5])
Expand Down

0 comments on commit e3755b1

Please sign in to comment.