← Indietro
EsameEsame completoTesto d’esame

16 06 2022 E T LAB

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 - Jume 16th 2022 Duration of the exam: 2.5 hours. Exercise 1 We consider a database containing the temperature in four corners of a room as a function of time. Each row of the matrix A refers to a time and each column represents the temperature in a corner of the room. import pandas as pd import numpy as np import matplotlib.pyplot as plt data = pd.read_csv(’https://openmv.net/file/room-temperature.csv’) labels = [’FrontLeft’, ’FrontRight’, ’BackLeft’, ’BackRight’] A = data.to_numpy()[:,1:].astype(np.float64) A -= 273.15 #from Kelvin to Celsius 1. How many samples and features are there in the dataset ? 2. Plot the values over time of the temperature in the four corners of the room. From the figure, what can you tell about the potential for dimensionality reduction of the dataset? 3. Perform PCA on the dataset by means of the SVD decomposition. Then, plot the trend of the fraction of the ”explained variance”: ∑k i=1σ2 i∑q i=1σ2 i ; 4. Print the four principal directions. 5. By using the principal directions computed above, perform dimensionality reduction using only the first k principal directions. Repeat the exercise for k = 1, 2, 3. 6. Plot the values over time of the temperature in the four corners of the room, obtained from the recon- structions of rank 1, 2 and 3 obtained above. 7. Comment on the results of points 3,4 and 6. Exercise 2 Consider the Boston dataset contained in scikit-learn: import numpy as np from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split # Load the Boston housing dataset. X_boston, y_boston = load_boston(return_X_y=True) # Split into 60% training, 20% validation and 20% test. X_boston_tr, X_rest, y_boston_tr, y_rest = \…

Anteprima

Prima pagina del documento.

Prima pagina: 16 06 2022 E T LAB