You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-14Lines changed: 19 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,17 +18,19 @@ The problem is illustrated below, where the red dot indicates the position on th
18
18
19
19
Your task is to solve this problem using gradient descent.
20
20
>> **Recap**:
21
-
Starting from position $x_0 = 5 $, we use the gradient of the parabola to find the next position on the x-axis that should be closer to the optimal position, where f takes on its minimum value.
22
-
Specifically:
23
-
**a.** Take the last position $x_{n-1}$ in **pos_list**.
24
-
**b.** Calculate the derivative of $f$ at $x_{n-1}$.
25
-
- This gives us the direction of the steepest ascent at the last position $x_{n-1}$.
26
-
- Since our goal is to reach the minimum, we want to go into the opposite direction.
27
-
**c.** The step-size-parameter ($\epsilon$) tells us, how big of a step we take. This value is multiplied with the derivative calculated in **b.**
28
-
**d.** Substract the value you get in **c.** from the last position $x_{n-1}$ to get the new position $x_n$
29
-
All these steps together define one iteration of the gradient descent algorithm:
30
-
$$x_n = x_{n-1} - \epsilon\frac{df(x)}{dx}$$
31
-
This step is repeated, until a stopping criterion is met. In this task, we decide to set a fixed number of iterations we do until we stop.
21
+
Starting from position $x_0 = 5 $, we use the gradient of the parabola to find the next position on the x-axis that should be closer to the optimal position, where f takes on its minimum value.
22
+
>> Specifically:
23
+
>> **a.** Take the last position $x_{n-1}$ in **pos_list**.
24
+
>> **b.** Calculate the derivative of $f$ at $x_{n-1}$.
25
+
>> - This gives us the direction of the steepest ascent at the last position $x_{n-1}$.
26
+
>> - Since our goal is to reach the minimum, we want to go into the opposite direction.
27
+
>> **c.** The step-size-parameter ($\epsilon$) tells us, how big of a step we take. This value is multiplied with the derivative calculated in **b.**
28
+
>> **d.** Substract the value you get in **c.** from the last position $x_{n-1}$ to get the new position $x_n$
29
+
>> All these steps together define one iteration of the gradient descent algorithm:
30
+
>> $$
31
+
x_n = x_{n-1} - \epsilon\frac{df(x)}{dx}
32
+
>> $$
33
+
>> This step is repeated, until a stopping criterion is met. In this task, we decide to set a fixed number of iterations we do until we stop.
32
34
33
35
1. Compute the derivative of the parabola in the method `derivative_parabola`.
34
36
@@ -47,8 +49,10 @@ We mark vectors by writing them in bold font ($\mathbf{x}$) and $\cdot$ denotes
The paraboloid is already implemented in `src/optimize_2d.py`.
50
-
Once more the problem is illustrated below:
52
+
Once more the problem is illustrated below:
53
+
51
54

55
+
52
56
The horizontal axis represents the first entry $x_0$ of $\mathbf{x}$ and the vertical axis the second entry $x_1$. The red dot indicates the starting position. The function values are now represented as color values: The darker the color, the lower the corresponding function value. You can think of the illustration as looking at the 2-dimensional paraoboloid from above.
53
57
54
58
Your task is to solve this problem using two-dimensional gradient descent.
@@ -63,14 +67,15 @@ Go to the `main`-function.
63
67
3. Implement the gradient-descent algorithm as described in the lecture.
The addtional sine and cosine terms will require momentum for convergence in order to overcome the bumps and not get stuck in a sub-optimal, local minimum.
72
76
The bumpy paraboloid is already implemented in `src/optimize_2d_momentum_bumpy.py`.
0 commit comments