Back
ExamFull examExam paper only

06 09 2023 E T LAB

Full exam for Numerical Analysis for Machine Learning in the Mathematical Engineering degree programme at Politecnico di Milano. The document covers: 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

Numerical Analysis for Machine LearningFull exam

Document information

What's included in this study material

Full exam for Numerical Analysis for Machine Learning in the Mathematical Engineering degree programme at Politecnico di Milano. The document covers: 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

Import quality: text was extracted directly from the original document.

Extracted content from the document

Representative passages recognised in different parts of the material. The full extracted text remains available to search, while this compact preview makes the page easier to read.

Page 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…

Preview

First page of the document.

First page: 06 09 2023 E T LAB