Spaces:
Running
Running
fixed gd_bivariate bug
Browse files
backend/src/optimization_logic.py
CHANGED
|
@@ -86,8 +86,10 @@ def gd_bivariate(
|
|
| 86 |
mx = momentum * (x_values[-1] - x_values[-2])
|
| 87 |
my = momentum * (y_values[-1] - y_values[-2])
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
| 91 |
x_values.append(x)
|
| 92 |
y_values.append(y)
|
| 93 |
z_values.append(f(x, y))
|
|
|
|
| 86 |
mx = momentum * (x_values[-1] - x_values[-2])
|
| 87 |
my = momentum * (y_values[-1] - y_values[-2])
|
| 88 |
|
| 89 |
+
x_new = x - learning_rate * fx(x, y) + mx
|
| 90 |
+
y_new = y - learning_rate * fy(x, y) + my
|
| 91 |
+
x = x_new
|
| 92 |
+
y = y_new
|
| 93 |
x_values.append(x)
|
| 94 |
y_values.append(y)
|
| 95 |
z_values.append(f(x, y))
|