Skip to content

Commit 1549c20

Browse files
committed
formating
1 parent b2f8f8f commit 1549c20

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ $$
2929
1 & a_2^1 & a_2^2 & \dots & a_2^{n-1} \\\\
3030
1 & a_3^1 & a_3^2 & \dots & a_3^{n-1} \\\\
3131
\vdots & \vdots & \vdots & \ddots & \vdots \\\\
32-
1 & a_m^1 & a_m^2 & \dots & a_m^{n-1} \\\\
32+
1 & a_m^1 & a_m^2 & \dots & a_m^{n-1}
3333
\end{pmatrix} \cdot
3434
\begin{pmatrix}
3535
c_1 \\\\
3636
\vdots \\\\
37-
c_n \\\\
37+
c_n
3838
\end{pmatrix} = \begin{pmatrix}
3939
b_1 \\\\
4040
b_2 \\\\
4141
b_3 \\\\
4242
\vdots \\\\
43-
b_m \\\\
43+
b_m
4444
\end{pmatrix}
4545
$$
4646

@@ -83,7 +83,7 @@ $$
8383
1 & a_2^1 & a_2^2 & \dots & a_2^{n-1} \\\\
8484
1 & a_3^1 & a_3^2 & \dots & a_3^{n-1} \\\\
8585
\vdots & \vdots & \vdots & \ddots & \vdots \\\\
86-
1 & a_m^1 & a_m^2 & \dots & a_m^{n-1} \\\\
86+
1 & a_m^1 & a_m^2 & \dots & a_m^{n-1}
8787
\end{pmatrix}
8888
$$
8989

@@ -94,7 +94,7 @@ $$
9494
$$
9595
\mathbf{A}_2^{\dagger}\mathbf{b} = \mathbf{c} = \begin{pmatrix}
9696
c_1 \\\\
97-
c_2 \\\\
97+
c_2
9898
\end{pmatrix}
9999
$$
100100

@@ -116,7 +116,7 @@ What do you see?
116116

117117

118118

119-
#### ⊙Task 1.3: Regularization
119+
#### Task 1.3: Regularization
120120
Unfortunately, the fit is not ideal. The polynomial is too complex and tracks the noise.
121121
The singular value decomposition (SVD) can help!
122122
Recall that the SVD turns a matrix
@@ -178,14 +178,14 @@ Setting n=300 turns A into a square matrix. In this case, the zero block in the
178178

179179
To sum it up, your tasks are:
180180
1. Compute the SVD of A.
181-
182-
Perform the following steps 2. - 4. for epsilon equal to 0.1, 1e-6, and 1e-12.
183181
2. Compute the diagonal for the filter matrix and turn it into a matrix.
184182
3. Estimate the regularized coefficients by applying the formula above.
185183
4. Plot the result.
186184

185+
Perform the steps 2. - 4. for epsilon equal to 0.1, 1e-6, and 1e-12.
186+
187187

188-
#### ✪Task 1.4: Model Complexity (Optional):
188+
#### Task 1.4: Model Complexity (Optional):
189189
Another solution to the overfitting problem is reducing the complexity of the model.
190190
To assess the quality of polynomial fit to the data, compute and plot the Mean Squared Error (Mean Squared Error measure how close the regression line is to data points) for every degree of polynomial upto 20.
191191
So as before:
@@ -207,7 +207,7 @@ Now we are ready to deal with real data! Feel free to use your favorite time ser
207207
The file `./data/pegel.tab` contains the Rhine water levels measured in Bonn over the last 100 years.
208208
Data source: https://pegel.bonn.de.
209209

210-
#### ⊙Task 2.1 Regression
210+
#### Task 2.1 Regression
211211
The `src/pegel_bonn.py` file already contains code to pre-load the data for you.
212212
The Rhine level measurements will be your new vector $\mathbf{b}$ from before.
213213
Now we want to do the same as in Part 1 and start with linear regression!
@@ -233,16 +233,17 @@ Re-using the code you wrote for the proof of concept task, fit a polynomial of d
233233

234234

235235

236-
#### ⊙Task 2.3: Regularization
236+
#### Task 2.3: Regularization
237237
Focus on the data from the year 2000 onward and filter the singular values.
238238
We will use again a degree of 20.
239239
Matrix A is not square in this case, because the degree is smaller than the number of datapoints! Consequently, a zero block must appear in your singular value matrix and when computing the Pseudoinverse from the SVD, $\sigma$ has to be transposed!
240240
Like in Part 1:
241-
1. Compute the SVD of the point matrix from the previous task.
242241

243-
Perform the following steps 2. - 4. for epsilon equal to 0.1, 1e-3, and 1e-9.
242+
1. Compute the SVD of the point matrix from the previous task.
244243
2. Compute the filter matrix.
245244
3. Estimate the regularized coefficients by applying the formula from before.
246245
> **Hint:** Remember the zero-block! You need degree-many rows and number-of-datapoints-many columns!
247246
4. Evaluate the regularized polynomial and plot the results.
248247

248+
Perform the steps 2. - 4. for epsilon equal to 0.1, 1e-3, and 1e-9.
249+

0 commit comments

Comments
 (0)