Skip to content

Commit 1434e59

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

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

gradient descent python

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ X = scaler.fit_transform(X)
1414

1515
X_b = np.c_[np.ones((X.shape[0], 1)), X] # shape (n_samples, 2)
1616

17-
theta = np.random.randn(2)
17+
theta = np.random.randn(2)
1818
learning_rate = 0.1
1919
iterations = 100
2020
m = len(y)
@@ -28,7 +28,7 @@ for i in range(iterations):
2828
errors = predictions - y
2929
gradient = (2/m) * X_b.T.dot(errors)
3030
theta = theta - learning_rate * gradient
31-
31+
3232
loss = (1/m) * np.sum(errors**2) # MSE
3333
loss_history.append(loss)
3434

0 commit comments

Comments
 (0)