please, didactically solve this Machine Learning exam. Solve all steps and proceed with reasoning over all the exercises. Answer with completeness and soundness. If you need to illustrate, try to draw it using ASCII art. Format your answer in Markdown.

\documentclass[a4paper]{article}
\usepackage[solutions%show/hide the solutions
		    ]{verifiche}
\usepackage{listings}
\lstset{basicstyle=\ttfamily,
literate=% Allow for German characters in lstlistings.
{Ö}{{\"O}}1
{Ä}{{\"A}}1
{Ü}{{\"U}}1
{ß}{{\ss}}2
{ü}{{\"u}}1
{ä}{{\"a}}1
{ö}{{\"o}}1
{á}{{\'a}}1
{é}{{\'e}}1
{à}{{\'a}}1
{è}{{\'e}}1
}
\usepackage[margin=3cm]{geometry}
\usepackage{lipsum}
\usepackage{amsmath}
 
\begin{document}
 
 
%\renewcommand{\institutefont}{\huge}
\renewcommand{\closedquestionitem}{$\bigcirc$}
\renewcommand{\headercandidatenamelabel}{First and last name}
\renewcommand{\headerclasslabel}{Student ID}
\renewcommand{\headerdatelabel}{}
\setlength{\daterulerlength}{0pt}
\setlength{\candidatenamerulerlength}{210pt}
\setlength{\classrulerlength}{65pt}
 
%\institute{}
 
\institute{}
\asyear[]{\centerline{\includegraphics[]{images/poliba.png}}}
\testtype{\normalsize{
\centerline{\textbf{FOUNDATIONS OF MACHINE LEARNING}}\\
\centerline{\textbf{ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING} (ML TEST)}\\
\centerline{\textbf{MACHINE LEARNING AND ARTIFICIAL INTELLIGENCE} (ML TEST)}\\
\centerline{\normalfont{Academic Year 2022/2023 – 1st Exam Session}}\\
\centerline{\normalfont{25/01/2023}}}
}
\instruction{\vspace{-0.8em}}
\duration[Test duration:]{1,5 hours}
\printheading
%\centerline{\includegraphics[]{images/poliba.png}}
 
 
\pagestyle{verifiche}
 
\begin{esercizio}[label=Question]
Derive the solution of the univariate linear regression with the normal equations.
\end{esercizio}
 
\begin{esercizio}[label=Question]
Derive the cost function of logistic regression using a probabilistic approach.%\\[1em]
%\openquestion[type=squares, height=9cm, linecolor=black!30]{} &pag 510 slide
\end{esercizio}
 
% \begin{soluzione}
% Il mattone pesa \SI{2}{kg}.
% \end{soluzione}
 
% \begin{esercizio}[label=Question]
% Suppose you have a dataset of $n$ samples. Among them, there are missing values. To address this issue, which approaches could you apply?
% \end{esercizio}
 
\begin{esercizio}[label=Question]%
In which context learning curves are useful? How do they work? %\\[1em]
%\openquestion[height=5cm, linecolor=black!30]{} %pag 193 slide
\end{esercizio}
 
 
% \begin{esercizio}[label=Question]
% Consider the neural network represented below with one hidden layer, where $a_i^{(j)}$ is the activation of unit $i$ in layer $j$ with an activation function $g$ and $\Theta^{(j)}$ is the matrix of weights controlling the mapping from layer $j$ to layer $j+1$. Write the vectorized representation of the network expliciting the shapes of the involved objects and considering a bias unit for the hidden layer.
% Then, describe the vectorized implementation of the forward propagation step to obtain the output $h_\Theta(x)$.\\ %pag. 383 slide
% \centerline{\includegraphics[width=0.5\textwidth]{images/NN.png}}\\
% \end{esercizio}
 
 
\begin{esercizio}[label=Question]
Consider the following linear regression model:\\
\centerline{\includegraphics[width=0.32\textwidth]{images/model.png}}\\
Assume that the current weights are $w_0 = 0$, $w_1 = 1$, $w_2 = 0.5$ and we have the following set of examples $(\mathbf{X}, \mathbf{y})$:\\
\begin{equation*}
  \mathbf{X} = \begin{bmatrix}
2 & 1 \\
-3 & 4 \\
0 & 5 \\
\end{bmatrix}, \quad
\mathbf{y} = \begin{bmatrix}
2 \\
4 \\
2 \\
\end{bmatrix},
\end{equation*}\\
where each row in $\mathbf{X}$ represents a data point and each entry in $\mathbf{y}$ represents the
corresponding target value.
Compute the initial value of loss fuction and a \textbf{single step} of Gradient Descent to update the $w_i$ parameters with \textit{Full Batch} and in \textit{Stochastic} solution, using a learning rate $\alpha=0.01$.
%\openquestion[type=squares, height=6cm, linecolor=black!30]{}
\end{esercizio}
 
\clearpage
 
\begin{esercizio}[label=Question]
Given the following training set with dogs data create a decision tree based on attribute ``Class".\\
\begin{table}[h!]
\centering
 
\begin{tabular}{|l|l|l|l|l||l|}
 
\hline
\textbf{Sample} & \textbf{Shape} & \textbf{Size} & \textbf{Smelly} & \textbf{Colour} & \textbf{Poisonous} \\ 
\hline
A         & 1       & 0         & 0  & 0  & 1\\ 
\hline
B          & 1       & 0          & 1   & 0  & 1  \\ 
\hline
C          & 0       & 1         & 0  & 1  & 1   \\ 
\hline
D          & 0        & 0         & 0  & 1 & 0 \\ 
\hline
E       & 1        & 1         & 1  & 0 & 0 \\ 
\hline
F         & 1      & 0         & 1  & 1  & 0\\ 
\hline
G          & 1       & 0           & 0  & 1  & 0 \\
\hline
H          & 0       & 1           & 0  & 0  & 0 \\
\hline
\end{tabular}
\end{table}
\end{esercizio}
 
 
\begin{esercizio}[label=Question]
Describe the motivations and explain the aims of the PCA algorithm. 
\end{esercizio}
 
\begin{esercizio}[label=Question]
Which are the differences between a classical neural network and an autoencoder?
\end{esercizio}
\end{document}
 
 
% compile 2 times
\documentclass[a4paper]{article}
\usepackage[solutions%show/hide the solutions
		    ]{verifiche}
\usepackage{listings}
\lstset{basicstyle=\ttfamily,
literate=% Allow for German characters in lstlistings.
{Ö}{{\"O}}1
{Ä}{{\"A}}1
{Ü}{{\"U}}1
{ß}{{\ss}}2
{ü}{{\"u}}1
{ä}{{\"a}}1
{ö}{{\"o}}1
{á}{{\'a}}1
{é}{{\'e}}1
{à}{{\'a}}1
{è}{{\'e}}1
}
\usepackage[margin=3cm]{geometry}
\usepackage{lipsum}
 
\begin{document}
 
 
%\renewcommand{\institutefont}{\huge}
\renewcommand{\closedquestionitem}{$\bigcirc$}
\renewcommand{\headercandidatenamelabel}{First and last name}
\renewcommand{\headerclasslabel}{Student ID}
\renewcommand{\headerdatelabel}{}
\setlength{\daterulerlength}{0pt}
\setlength{\candidatenamerulerlength}{210pt}
\setlength{\classrulerlength}{65pt}
 
%\institute{}
 
\institute{}
\asyear[]{\centerline{\includegraphics[]{images/poliba.png}}}
\testtype{\normalsize{
\centerline{\textbf{FOUNDATIONS OF MACHINE LEARNING}}\\
\centerline{\textbf{ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING} (ML TEST)}\\
\centerline{\textbf{MACHINE LEARNING AND ARTIFICIAL INTELLIGENCE} (ML TEST)}\\
\centerline{\normalfont{Academic Year 2022/2023 – 1st Exam Session}}\\
\centerline{\normalfont{25/01/2023}}}
}
\instruction{\vspace{-0.8em}}
\duration[Test duration:]{1,5 hours}
\printheading
%\centerline{\includegraphics[]{images/poliba.png}}
 
 
\pagestyle{verifiche}
 
\begin{esercizio}[label=Question]
Derive the solution of the univariate linear regression with the normal equations.
\end{esercizio}
 
\begin{esercizio}[label=Question]
Derive the cost function of logistic regression using a probabilistic approach.%\\[1em]
%\openquestion[type=squares, height=9cm, linecolor=black!30]{} &pag 510 slide
\end{esercizio}
 
% \begin{soluzione}
% Il mattone pesa \SI{2}{kg}.
% \end{soluzione}
 
% \begin{esercizio}[label=Question]
% Suppose you have a dataset of $n$ samples. Among them, there are missing values. To address this issue, which approaches could you apply?
% \end{esercizio}
 
\begin{esercizio}[label=Question]%
In which context learning curves are useful? How do they work? %\\[1em]
%\openquestion[height=5cm, linecolor=black!30]{} %pag 193 slide
\end{esercizio}
 
 
% \begin{esercizio}[label=Question]
% Consider the neural network represented below with one hidden layer, where $a_i^{(j)}$ is the activation of unit $i$ in layer $j$ with an activation function $g$ and $\Theta^{(j)}$ is the matrix of weights controlling the mapping from layer $j$ to layer $j+1$. Write the vectorized representation of the network expliciting the shapes of the involved objects and considering a bias unit for the hidden layer.
% Then, describe the vectorized implementation of the forward propagation step to obtain the output $h_\Theta(x)$.\\ %pag. 383 slide
% \centerline{\includegraphics[width=0.5\textwidth]{images/NN.png}}\\
% \end{esercizio}
 
 
\begin{esercizio}[label=Question]
Consider the following linear regression model:\\
\centerline{\includegraphics[width=0.32\textwidth]{images/model.png}}\\
Assume that the current weights are $w_0 = 0$, $w_1 = 1$, $w_2 = 0.5$ and we have the following set of examples $(\mathbf{X}, \mathbf{y})$:\\
\begin{equation*}
  \mathbf{X} = \begin{bmatrix}
2 & 1 \\
-3 & 4 \\
0 & 5 \\
\end{bmatrix}, \quad
\mathbf{y} = \begin{bmatrix}
2 \\
4 \\
2 \\
\end{bmatrix},
\end{equation*}\\
where each row in $\mathbf{X}$ represents a data point and each entry in $\mathbf{y}$ represents the
corresponding target value.
Compute the initial value of loss fuction and a \textbf{single step} of Gradient Descent to update the $w_i$ parameters with \textit{Full Batch} and in \textit{Stochastic} solution, using a learning rate $\alpha=0.01$.
%\openquestion[type=squares, height=6cm, linecolor=black!30]{}
\end{esercizio}
 
\clearpage
 
\begin{esercizio}[label=Question]
Given the following training set with dogs data create a decision tree based on attribute ``Class".\\
\begin{table}[h!]
\centering
 
\begin{tabular}{|l|l|l|l|l||l|}
 
\hline
\textbf{Sample} & \textbf{Shape} & \textbf{Size} & \textbf{Smelly} & \textbf{Colour} & \textbf{Poisonous} \\ 
\hline
A         & 1       & 0         & 0  & 0  & 1\\ 
\hline
B          & 1       & 0          & 1   & 0  & 1  \\ 
\hline
C          & 0       & 1         & 0  & 1  & 1   \\ 
\hline
D          & 0        & 0         & 0  & 1 & 0 \\ 
\hline
E       & 1        & 1         & 1  & 0 & 0 \\ 
\hline
F         & 1      & 0         & 1  & 1  & 0\\ 
\hline
G          & 1       & 0           & 0  & 1  & 0 \\
\hline
H          & 0       & 1           & 0  & 0  & 0 \\
\hline
\end{tabular}
\end{table}
\end{esercizio}
 
 
\begin{esercizio}[label=Question]
Describe the motivations and explain the aims of the PCA algorithm. 
\end{esercizio}
 
\begin{esercizio}[label=Question]
Which are the differences between a classical neural network and an autoencoder?
\end{esercizio}
\end{document}
 
 
 
ha il menu contestuale