← Indietro
EsameEsame completoTesto d’esame

06 07 2023 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 - July 6th 2023 Duration of the exam: 2.5 hours. Exercise 1 Consider the picture of the Duomo di Milano given in file duomo.jpg. import matplotlib.pyplot as plt import numpy as np from matplotlib.image import imread image_path = 'duomo.jpg' img = imread(image_path) A = np.mean(np.array(img, dtype = np.float64)/255, axis = -1) plt.imshow(A, cmap = 'gray') plt.axis('off') A.shape 1. Compute the SVD associated with the picture, by using the standard algorithm, that gives the exact (up to round-off errors) decomposition. Then, plot the trend w.r.t. i of the singular values σi . Then, repeat the computation by considering the randomized SVD algorithm of rank k = 25, 50, 100, 200 and 400 . Plot the approximate singular values together with the exact singular values. Comment what you see. 2. We now want to compress the image. • Use the exact SVD to perform image compression for rank k = 25 , 50, 100, 200 and 400. Plot the compressed image and compute the reconstruction error as a function of k (use the matrix p-norm with p = 2). • Repeat the same exercise by using the randomized SVD algorithm. • Repeat the same exercise by using the randomized SVD algorithm with a +50% oversampling, that is by increasing by 50% the number of columns in the matrix random P (round the quantity 1.5k to the closest integer). • Finally, plot the trend of the reconstruction error of the dataset as a function of k in the three cases. Comment on the results. 3. Evaluate the time needed to compute the SVD with the three approaches (SVD, randomized SVD, ran- domized SVD with oversampling) in the case k = 200. Exercise 2 Consider the following function (where x = (x, y)) f(x) = 5x2 − 6xy + 5y2 + 4x + 4y (1) 1. Plot the function. 2. Compute…

Anteprima

Prima pagina del documento.

Prima pagina: 06 07 2023 E T LAB