← Indietro
EsameEsame completoTesto d’esame

06 09 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 - September 6th 2023 Duration of the exam: 2.5 hours. Exercise 1 Load the image of the Karman vortices with the following commands from matplotlib.image import imread import matplotlib.pyplot as plt import numpy as np import os plt.rcParams['figure.figsize'] = [16,8] A =imread(os.path.join('.','Karman_vortex.jpg')) X = np.mean(A,-1); # Convert RGB to grayscale img = plt.imshow(X) img.set.cmap('gray') plt.show() 1. Compute the economy SVD. 2. Let X be the matrix representing the true image and ˜X the approximation of rank r obtained using the SVD. Compute and plot the relative reconstruction error of the truncated SVD in the Frobenius norm as a function of the rank r. The expression of the relative reconstruction error is given by: ∥X − ˜X∥F ∥X∥F . 3. Square this error (and plot it) to compute the fraction of the missing variance as a function of r. 4. Find the rank ˜r for which the reconstruction captures 99% of the total variance. Exercise 2 Generate 100 artificial data points ( xi, yi) where xi is randomly generated in the interval [0 , 1] and yi = cos(4πxi) +ϵ; ϵ is a random noise in the interval [−0.2, 0.2]. Implement the SGD method to solve the regression problem for the data you have generated. Use an initial constant learning rate η = 0.001 an train a polynomial of the form hc = c0 + c1x + c2x2 + . . . + cnxn using your data ( n is the maximum degree of the polynomial). Assume that all the initial parameters ci are randomly generated in [ −0.4, 0.4]. Try different values of n. Try also different values for α to speed up the learning process. Plot the various results and comment them. Exercise 3 Consider a sigmoid neuron with 1D input x, weight w, bias b and output y = σ(wx + b). The target is the…

Anteprima

Prima pagina del documento.

Prima pagina: 06 09 2023 E T LAB