Skip to content

Commit b5c6153

Browse files
committed
small changes
1 parent c9c26e4 commit b5c6153

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@ The problem is illustrated below, where the red dot indicates the position on th
1818

1919
Your task is to solve this problem using gradient descent.
2020
>> **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.
3234
3335
1. Compute the derivative of the parabola in the method `derivative_parabola`.
3436

@@ -47,8 +49,10 @@ We mark vectors by writing them in bold font ($\mathbf{x}$) and $\cdot$ denotes
4749
$$\min_{\mathbf{x}} \mathbf{x} \cdot \mathbf{x} = (x_0, x_1) \cdot (x_0, x_1) = x_0x_0 + x_1x_1, \text{ with } \mathbf{x_0} = (2.9, -2.9) .$$
4850

4951
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+
5154
![paraboloid_task](./figures/paraboloid_task.png)
55+
5256
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.
5357

5458
Your task is to solve this problem using two-dimensional gradient descent.
@@ -63,14 +67,15 @@ Go to the `main`-function.
6367
3. Implement the gradient-descent algorithm as described in the lecture.
6468

6569

66-
### Task 3: Bumpy Paraboloid
70+
### ✪ Optional Task 3: Bumpy Paraboloid
6771
Additionally we consider a bumpy paraboloid:
6872

6973
$$\min_{\mathbf{x}} \mathbf{x} \cdot \mathbf{x} + \cos(2 \pi x_0) + \sin(2 \pi x_1 ), \text{ with } \mathbf{x_0} = (2.9, -2.9) .$$
7074

7175
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.
7276
The bumpy paraboloid is already implemented in `src/optimize_2d_momentum_bumpy.py`.
7377
Once more the problem is illustrated below:
78+
7479
![bumpy_paraboloid_task](./figures/bumpy_paraboloid_task.png)
7580

7681
Your task is to solve this problem using two-dimensional gradient descent with momentum.
@@ -88,7 +93,7 @@ Go to the `main`-function.
8893

8994
3. Implement the gradient-descent algorithm **with momentum** as described in the lecture.
9095

91-
### Task 4: Automatic Differentiation
96+
### ✪ Optional Task 4: Automatic Differentiation
9297
Finally, to explore the automatic differentiation functionality we consider the problem:
9398

9499
$$\min_{\mathbf{x}} \mathbf{x} \cdot \mathbf{x} + \cos(2 \pi x_0 ) + \sin(2 \pi x_1) + 0.5 \cdot \text{relu}(x_0) + 10 \cdot \tanh( \|\mathbf{x} \| ) \text{ with } \mathbf{x_0} = (2.9, -2.9) .$$

0 commit comments

Comments
 (0)