← Indietro
EsameEsame completoTesto d’esame

19 01 2021 E T

Esame completo di Numerical Analysis for Machine Learning per il corso di Mathematical Engineering presso Politecnico di Milano. Materiale proveniente dall’archivio storico Studwiz e classificato per la consultazione online.

Numerical Analysis for Machine LearningEsame completo

Informazioni sul documento

Cosa trovi in questo materiale

Esame completo di Numerical Analysis for Machine Learning per il corso di Mathematical Engineering presso Politecnico di Milano. Materiale proveniente dall’archivio storico Studwiz e classificato per la consultazione online.

Qualità dell’importazione: il testo è stato estratto direttamente dal documento originale.

Contenuti estratti dal documento

Passaggi rappresentativi riconosciuti nelle diverse parti del materiale. Il testo completo resta presente nella pagina per la ricerca, mentre l’anteprima compatta rende più semplice la lettura.

Pagina 1

Course: Numerical Analysis for Machine Learning Prof. E. Miglio - January 19th 2021 Duration of the exam: 2.5 hours. Exercise 1 We consider a database containing geometrical features of iris plants. The dataset can be loaded with the following commands: import pandas as pd import numpy as np import matplotlib.pyplot as plt data = pd.read_csv(’http://archive.ics.uci.edu/ml/machine-learning-databases/iris/ iris.data’, header = None).to_numpy() A = data[:, :4].T.astype(np.float64) labels = data[:,4] groups = (’Iris-setosa’,’Iris-versicolor’,’Iris-virginica’) Each column of the matrix A refers to a sample. Each rows corresponds to a feature. Specifically: ˆ the 1st row contains the sepal length in cm; ˆ the 2nd row contains the sepal width in cm; ˆ the 3rd row contains the petal length in cm; ˆ the 4th row contains the petal width in cm. The vector labels contains the class of iris plants each samples belongs to. There are three classes: ’Iris-setosa’, ’Iris-versicolor’ and ’Iris-virginica’. 1. How many samples are there in the dataset? How many samples belong to each class? 2. Perform PCA on the dataset by means of the SVD decomposition. Then, plot the trend of ˆ the singular values σk; ˆ the cumulate fraction of singular values ( ∑k i=1σi)/(∑q i=1σi); ˆ the fraction of the “explained variance” ( ∑k i=1σ2 i )/(∑q i=1σ2 i ). 3. Compute a matrix containing the principal components associated with the dataset. 4. Generate a scatterplot of the first two principal components of the dataset, grouped by label. 5. Comment on the results of point 4, in light of the results of point 2. Exercise 2 Give a brief explaination of the Gradient Descent method and motivate the introduction of the Stochastic Gradient Descent (SGD). Consider the following dataset import numpy as np m = 100…

Anteprima

Prima pagina del documento.

Prima pagina: 19 01 2021 E T