please,didactically solve this Machine Learning exam. solve all steps and proceed with reasoning over all the exercises.

% 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}
%\usepackage{subfigure}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{amsmath}
\captionsetup{font=small, labelfont=bf}
\captionsetup[sub]{labelsep=period, subrefformat=brace}
\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{Prof. Tommaso Di Noia}}\\
\centerline{\normalfont{Academic Year 2024/2025 – Mid Term Exam}} %1st Middle Exam}}\\
\centerline{\normalfont{06/11/2024}}}
}
\instruction{\vspace{-0.8em}}
\duration[Test duration:]{1,5 hours}
\printheading
%\centerline{\includegraphics[]{images/poliba.png}}


\pagestyle{verifiche}

\begin{esercizio}[label=Question]
Explain in detail the \textbf{differences} between supervised and unsupervised learning. Then, provide an example and list some algorithms for both cases.
\end{esercizio}

\begin{esercizio}[label=Question]
% Explain in detail what learning curves are and their link to the concept of bias and variance.

Explain in \textbf{detail} the concepts of bias and variance. Draw the relative learning curves.

% Explain in detail the splitting dataset techniques (Holdout, K-fold cross validation and Random subsampling)
%\openquestion[type=squares, height=9cm, linecolor=black!30]{} &pag 510 slide
\end{esercizio}


\begin{esercizio}[label=Question]%
Explain in \textbf{detail} the dataset splitting techniques and highlight the advantages of \textbf{each} of the possible techniques.

% Illustrate the operation of a random forest by explicitly clarifying the role of the \textit{bootstrap} and \textit{bagging} mechanism.%\\[1em]
%\openquestion[height=5cm, linecolor=black!30]{}
\end{esercizio}
%\openquestion[type=squares, height=8cm, linecolor=black!30]{}
%\\[1em]
%\openquestion[type=squares, height=8cm, linecolor=black!30]{}

% \begin{esercizio}[label=Question]

% Derive the probabilistic interpretation of the linear regression model using the Maximum Likelihood Criterion. Prove that this is \textbf{equivalent} to the MSE loss function.

% \end{esercizio}


\begin{esercizio}[label=Question]

Derive the probabilistic interpretation of the linear regression model using the Maximum Likelihood Criterion. Prove that this is \textbf{equivalent} to the MSE loss function.

\end{esercizio}


% \begin{esercizio}[label=Question]
% \textcolor{red}{cambia con domanda su NN}
% Describe the Support Vector Machines (SVMs) algorithm: focus on the main \textbf{differences} with respect to the Logistic Regression model. Discuss how to select the right \textbf{kernel} for the classification task.
% \end{esercizio}

\begin{esercizio}[label=Question]
You are a professor and you have to explain to your colleagues what is a neural network. Describe it by answering to the following points: \\
\begin{enumerate}
    \item what is a neural network;
    \item why (and when) one should employ a neural network instead of a Logistic Regression model for the classification task;
    \item what is the forward propagation (focus on its purpose and how it works);
    \item what is the backpropagation (focus on its purpose and how it works).
\end{enumerate}
\end{esercizio}


% In the figures below, each point is a sample in the dataset, while each curve represents a trained model on that samples for a regression task. Describe the situations depicted in each figure in terms of fitting, highlighting the models' characteristics. Then, for each model, draw the corresponding learning curves with respect to the error on the training set and test set and the epochs.
% %\openquestion[type=squares, height=9cm, linecolor=black!30]{} &pag 510 slide
% \begin{figure}[h!]
% \centering
%     \begin{subfigure}[b]{0.2\textwidth}
%     \centering
%     \includegraphics[width=2.8cm]{images/underfitting.png}
%     \caption{}
%     \label{fig:image1}
%     \end{subfigure}
% \quad
%     \begin{subfigure}[b]{0.2\textwidth}
%     \centering
%     \includegraphics[width=2.8cm]{images/ok.png}
%     \caption{}
%     \label{fig:image2}
%     \end{subfigure}
% \quad
%     \begin{subfigure}[b]{0.2\textwidth}
%     \centering
%     \includegraphics[width=2.8cm]{images/overfitting.png}
%     \caption{}
%     \label{fig:image3}
%     \end{subfigure}

% \end{figuzzzre}



\begin{esercizio}[label=Question]%
Briefly explain when computing quartiles is useful when building a machine learning model. Compute the quartiles for the following data: 12, 15, 18, 20, 22, 25, detailing the steps.
\end{esercizio}

\begin{esercizio}[label=Question]
Derive the solution of the Univariate Linear Regression with the Normal Equation.
\end{esercizio}

\begin{esercizio}[label=Question]
Explain the concept of regularization, highlighting the goal. Discuss the regularization approaches reporting the advantages and disadvantages of each of them.
\end{esercizio}

\begin{esercizio}[label=Question]
Consider the table below reporting the True Positive (TP), True Negative (TN), False Positive (FP), and False Negative (FN) values for different threshold values in a classification task. Build the related ROC curve. \\

\begin{table}[h!]
    \centering
\begin{tabular}{|c|c|c|c|c|}
\hline
Threshold & TP & TN & FP & FN \\
\hline
0.1 & 32 & 40 & 8 & 20 \\
0.2 & 30 & 42 & 6 & 22 \\
0.3 & 28 & 44 & 4 & 24 \\
0.4 & 26 & 46 & 2 & 26 \\
\hline
\end{tabular}
\end{table}
\end{esercizio}

\begin{esercizio}[label=Question]%
Consider the following \textbf{linear regression} model: \( y = \theta_0 + \theta_1 x_1 + \theta_2 x_2 \). Assume that the current weights are \( \theta_0 = 1 \), \( \theta_1 = -0.5 \), \( \theta_2 = 0.8 \). Given the following set of samples \( (\mathbf{X}, \mathbf{y}) \), where each row in \( \mathbf{X} \) represents a data point and each entry in \( \mathbf{y} \) represents the corresponding target value: \\

\begin{equation*}
  \mathbf{X} = \begin{bmatrix}
3 & -2 \\
1 & 5 \\
-4 & 3 \\
\end{bmatrix}, \quad
\mathbf{y} = \begin{bmatrix}
1 \\
2 \\
0 \\
\end{bmatrix},
\end{equation*}

Compute the initial value of the loss function and a \textbf{single step} of Gradient Descent to update the \( \theta_i \) parameters with \textit{Full Batch} and in \textit{Stochastic} solution, using a learning rate \( \alpha = 0.05 \).
\end{esercizio}





\end{document}