Skip to content

Commit 5952608

Browse files
committed
update
1 parent 504dc6c commit 5952608

62 files changed

Lines changed: 2099 additions & 60 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
9.36 KB
Binary file not shown.
23.3 KB
Binary file not shown.
26 Bytes
Binary file not shown.
Lines changed: 333 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,333 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "6cc2501d",
6+
"metadata": {
7+
"editable": true
8+
},
9+
"source": [
10+
"<!-- HTML file automatically generated from DocOnce source (https://github.com/doconce/doconce/)\n",
11+
"doconce format html exercisesweek47.do.txt -->\n",
12+
"<!-- dom:TITLE: Exercise week 47-48 -->"
13+
]
14+
},
15+
{
16+
"cell_type": "markdown",
17+
"id": "7aae5111",
18+
"metadata": {
19+
"editable": true
20+
},
21+
"source": [
22+
"# Exercise week 47-48\n",
23+
"**November 17-28, 2025**\n",
24+
"\n",
25+
"Date: **Deadline is Friday November 28 at midnight**"
26+
]
27+
},
28+
{
29+
"cell_type": "markdown",
30+
"id": "5ef837a4",
31+
"metadata": {
32+
"editable": true
33+
},
34+
"source": [
35+
"# Overarching aims of the exercises this week\n",
36+
"\n",
37+
"The exercise set this week is meant as a summary of many of the\n",
38+
"central elements in various machine learning algorithms we have discussed throught the semester. You don't need to answer all questions."
39+
]
40+
},
41+
{
42+
"cell_type": "markdown",
43+
"id": "3f1ef66b",
44+
"metadata": {
45+
"editable": true
46+
},
47+
"source": [
48+
"## Linear and logistic regression methods"
49+
]
50+
},
51+
{
52+
"cell_type": "markdown",
53+
"id": "e86c9231",
54+
"metadata": {
55+
"editable": true
56+
},
57+
"source": [
58+
"### Question 1:\n",
59+
"\n",
60+
"Which of the following is not an assumption of ordinary least squares linear regression?\n",
61+
"\n",
62+
"* There is a linearity between predictors/features and target/outout\n",
63+
"\n",
64+
" * The inputs/features distributed according to a normal/gaussian distribution"
65+
]
66+
},
67+
{
68+
"cell_type": "markdown",
69+
"id": "9acef906",
70+
"metadata": {
71+
"editable": true
72+
},
73+
"source": [
74+
"### Question 2:\n",
75+
"\n",
76+
"The mean squared error cost function for linear regression is convex in the parameters, guaranteeing a unique global minimum. True or False? Motivate your answer."
77+
]
78+
},
79+
{
80+
"cell_type": "markdown",
81+
"id": "fb3bf02e",
82+
"metadata": {
83+
"editable": true
84+
},
85+
"source": [
86+
"### Question 3:\n",
87+
"\n",
88+
"Which statement about logistic regression is false?\n",
89+
"\n",
90+
"* Logistic regression is used for binary classification.\n",
91+
"\n",
92+
" * It uses the sigmoid function to map linear scores to probabilities.\n",
93+
"\n",
94+
" * It has an analytical closed-form solution.\n",
95+
"\n",
96+
" * Its log-loss (cross-entropy) is convex."
97+
]
98+
},
99+
{
100+
"cell_type": "markdown",
101+
"id": "e8ab306a",
102+
"metadata": {
103+
"editable": true
104+
},
105+
"source": [
106+
"### Question 4:\n",
107+
"\n",
108+
"Logistic regression produces a linear decision boundary in the input space. True or False? Explain."
109+
]
110+
},
111+
{
112+
"cell_type": "markdown",
113+
"id": "d695e6bb",
114+
"metadata": {
115+
"editable": true
116+
},
117+
"source": [
118+
"### Question 5:\n",
119+
"\n",
120+
"Give two reasons why logistic regression is preferred over linear regression for binary classification."
121+
]
122+
},
123+
{
124+
"cell_type": "markdown",
125+
"id": "8c398642",
126+
"metadata": {
127+
"editable": true
128+
},
129+
"source": [
130+
"## Neural networks"
131+
]
132+
},
133+
{
134+
"cell_type": "markdown",
135+
"id": "f58fac35",
136+
"metadata": {
137+
"editable": true
138+
},
139+
"source": [
140+
"### Question 6:\n",
141+
"\n",
142+
"Which statement is not true for fully-connected neural networks?\n",
143+
"\n",
144+
"* Without nonlinear activation functions they reduce to a single linear model.\n",
145+
"\n",
146+
" * Training relies on backpropagation using the chain rule.\n",
147+
"\n",
148+
" * A single hidden layer can approximate any continuous function on a compact set.\n",
149+
"\n",
150+
" * The loss surface of a deep neural network is convex."
151+
]
152+
},
153+
{
154+
"cell_type": "markdown",
155+
"id": "9bed2727",
156+
"metadata": {
157+
"editable": true
158+
},
159+
"source": [
160+
"### Question 7:\n",
161+
"\n",
162+
"Using sigmoid activations in many layers of a deep neural network can cause vanishing gradients. True or False? Explain."
163+
]
164+
},
165+
{
166+
"cell_type": "markdown",
167+
"id": "e3c1865d",
168+
"metadata": {
169+
"editable": true
170+
},
171+
"source": [
172+
"### Question 8:\n",
173+
"\n",
174+
"Describe the vanishing gradient problem: Why does it occur? Mention one technique to mitigate it and explain briefly."
175+
]
176+
},
177+
{
178+
"cell_type": "markdown",
179+
"id": "6d1ad1a8",
180+
"metadata": {
181+
"editable": true
182+
},
183+
"source": [
184+
"### Question 9:\n",
185+
"\n",
186+
"Consider a fully-connected network with layer sizes $n_0$ (the input\n",
187+
"layer) ,$n_1$ (first hidden layer), $\\dots, n_L$, where $n_L$ is the\n",
188+
"output layer. Derive a general formula for the total number of\n",
189+
"trainable parameters (weights + biases)."
190+
]
191+
},
192+
{
193+
"cell_type": "markdown",
194+
"id": "f5b2ed47",
195+
"metadata": {
196+
"editable": true
197+
},
198+
"source": [
199+
"## Convolutional Neural Networks"
200+
]
201+
},
202+
{
203+
"cell_type": "markdown",
204+
"id": "93d54a83",
205+
"metadata": {
206+
"editable": true
207+
},
208+
"source": [
209+
"### Question 10:\n",
210+
"\n",
211+
"Which of the following is not a typical property or advantage of CNNs?\n",
212+
"\n",
213+
"* Local receptive fields\n",
214+
"\n",
215+
" * Weight sharing\n",
216+
"\n",
217+
" * More parameters than fully-connected layers\n",
218+
"\n",
219+
" * Pooling layers offering some translation invariance"
220+
]
221+
},
222+
{
223+
"cell_type": "markdown",
224+
"id": "5aefcc46",
225+
"metadata": {
226+
"editable": true
227+
},
228+
"source": [
229+
"### Question 11:\n",
230+
"\n",
231+
"Using zero-padding in convolutional layers can preserve the input\n",
232+
"spatial dimensions when using a $3 \\times 3$ kernel/filter, stride 1,\n",
233+
"and padding $P = 1$. True or False?"
234+
]
235+
},
236+
{
237+
"cell_type": "markdown",
238+
"id": "348b6806",
239+
"metadata": {
240+
"editable": true
241+
},
242+
"source": [
243+
"### Question 12:\n",
244+
"\n",
245+
"Given input width $W$, kernel size $K$, stride S, and padding P,\n",
246+
"derive the formula for the output width $W_{\\text{out}} = \\frac{W - K+ 2P}{S} + 1$."
247+
]
248+
},
249+
{
250+
"cell_type": "markdown",
251+
"id": "a629397f",
252+
"metadata": {
253+
"editable": true
254+
},
255+
"source": [
256+
"### Question 13:\n",
257+
"\n",
258+
"A convolutional layer has: $C_{\\text{in}}$ input channels,\n",
259+
"$C_{\\text{out}}$ output channels (filters) and kernel size $K_h \\times\n",
260+
"K_w$. Compute the number of trainable parameters including biases."
261+
]
262+
},
263+
{
264+
"cell_type": "markdown",
265+
"id": "087780b2",
266+
"metadata": {
267+
"editable": true
268+
},
269+
"source": [
270+
"## Recurrent Neural Networks"
271+
]
272+
},
273+
{
274+
"cell_type": "markdown",
275+
"id": "55dd5f95",
276+
"metadata": {
277+
"editable": true
278+
},
279+
"source": [
280+
"### Question 14:\n",
281+
"\n",
282+
"Which statement about simple RNNs is false?\n",
283+
"\n",
284+
"* They maintain a hidden state updated each time step.\n",
285+
"\n",
286+
" * They use the same weight matrices at every time step.\n",
287+
"\n",
288+
" * They handle sequences of arbitrary length.\n",
289+
"\n",
290+
" * They eliminate the vanishing gradient problem."
291+
]
292+
},
293+
{
294+
"cell_type": "markdown",
295+
"id": "fd70bb6d",
296+
"metadata": {
297+
"editable": true
298+
},
299+
"source": [
300+
"### Question 15:\n",
301+
"\n",
302+
"LSTMs mitigate the vanishing gradient problem by using gating mechanisms (input, forget, output gates). True or False? Explain."
303+
]
304+
},
305+
{
306+
"cell_type": "markdown",
307+
"id": "ab7ec77a",
308+
"metadata": {
309+
"editable": true
310+
},
311+
"source": [
312+
"### Question 16:\n",
313+
"\n",
314+
"What is Backpropagation Through Time (BPTT) and why is it required for training RNNs?"
315+
]
316+
},
317+
{
318+
"cell_type": "markdown",
319+
"id": "e32e01d4",
320+
"metadata": {
321+
"editable": true
322+
},
323+
"source": [
324+
"### Question 17:\n",
325+
"\n",
326+
"What does a sliding window do? And why would we use it?"
327+
]
328+
}
329+
],
330+
"metadata": {},
331+
"nbformat": 4,
332+
"nbformat_minor": 5
333+
}

doc/LectureNotes/_build/html/chapter1.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@
266266
<li class="toctree-l1"><a class="reference internal" href="week45.html">Week 45, Convolutional Neural Networks (CCNs)</a></li>
267267
<li class="toctree-l1"><a class="reference internal" href="week46.html">Week 46: Decision Trees, Ensemble methods and Random Forests</a></li>
268268
<li class="toctree-l1"><a class="reference internal" href="week47.html">Week 47: Recurrent neural networks and Autoencoders</a></li>
269+
<li class="toctree-l1"><a class="reference internal" href="exercisesweek47.html">Exercise week 47-48</a></li>
270+
269271
</ul>
270272
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Projects</span></p>
271273
<ul class="nav bd-sidenav">

doc/LectureNotes/_build/html/chapter10.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@
266266
<li class="toctree-l1"><a class="reference internal" href="week45.html">Week 45, Convolutional Neural Networks (CCNs)</a></li>
267267
<li class="toctree-l1"><a class="reference internal" href="week46.html">Week 46: Decision Trees, Ensemble methods and Random Forests</a></li>
268268
<li class="toctree-l1"><a class="reference internal" href="week47.html">Week 47: Recurrent neural networks and Autoencoders</a></li>
269+
<li class="toctree-l1"><a class="reference internal" href="exercisesweek47.html">Exercise week 47-48</a></li>
270+
269271
</ul>
270272
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Projects</span></p>
271273
<ul class="nav bd-sidenav">

doc/LectureNotes/_build/html/chapter11.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@
266266
<li class="toctree-l1"><a class="reference internal" href="week45.html">Week 45, Convolutional Neural Networks (CCNs)</a></li>
267267
<li class="toctree-l1"><a class="reference internal" href="week46.html">Week 46: Decision Trees, Ensemble methods and Random Forests</a></li>
268268
<li class="toctree-l1"><a class="reference internal" href="week47.html">Week 47: Recurrent neural networks and Autoencoders</a></li>
269+
<li class="toctree-l1"><a class="reference internal" href="exercisesweek47.html">Exercise week 47-48</a></li>
270+
269271
</ul>
270272
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Projects</span></p>
271273
<ul class="nav bd-sidenav">

doc/LectureNotes/_build/html/chapter12.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@
266266
<li class="toctree-l1"><a class="reference internal" href="week45.html">Week 45, Convolutional Neural Networks (CCNs)</a></li>
267267
<li class="toctree-l1"><a class="reference internal" href="week46.html">Week 46: Decision Trees, Ensemble methods and Random Forests</a></li>
268268
<li class="toctree-l1"><a class="reference internal" href="week47.html">Week 47: Recurrent neural networks and Autoencoders</a></li>
269+
<li class="toctree-l1"><a class="reference internal" href="exercisesweek47.html">Exercise week 47-48</a></li>
270+
269271
</ul>
270272
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Projects</span></p>
271273
<ul class="nav bd-sidenav">

doc/LectureNotes/_build/html/chapter13.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@
266266
<li class="toctree-l1"><a class="reference internal" href="week45.html">Week 45, Convolutional Neural Networks (CCNs)</a></li>
267267
<li class="toctree-l1"><a class="reference internal" href="week46.html">Week 46: Decision Trees, Ensemble methods and Random Forests</a></li>
268268
<li class="toctree-l1"><a class="reference internal" href="week47.html">Week 47: Recurrent neural networks and Autoencoders</a></li>
269+
<li class="toctree-l1"><a class="reference internal" href="exercisesweek47.html">Exercise week 47-48</a></li>
270+
269271
</ul>
270272
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Projects</span></p>
271273
<ul class="nav bd-sidenav">

doc/LectureNotes/_build/html/chapter2.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@
266266
<li class="toctree-l1"><a class="reference internal" href="week45.html">Week 45, Convolutional Neural Networks (CCNs)</a></li>
267267
<li class="toctree-l1"><a class="reference internal" href="week46.html">Week 46: Decision Trees, Ensemble methods and Random Forests</a></li>
268268
<li class="toctree-l1"><a class="reference internal" href="week47.html">Week 47: Recurrent neural networks and Autoencoders</a></li>
269+
<li class="toctree-l1"><a class="reference internal" href="exercisesweek47.html">Exercise week 47-48</a></li>
270+
269271
</ul>
270272
<p aria-level="2" class="caption" role="heading"><span class="caption-text">Projects</span></p>
271273
<ul class="nav bd-sidenav">

0 commit comments

Comments
 (0)