Back
ExamFull examExam paper only

20 01 2023 E TS

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 - January 20th 2023 Duration of the exam: 2.5 hours. Exercise 1 Consider the following dataset (Petricoin et al., Lancet, 2002). Each column of A represents measurements taken from a patient. There are 216 columns

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 - January 20th 2023 Duration of the exam: 2.5 hours. Exercise 1 Consider the following dataset (Petricoin et al., Lancet, 2002). Each column of A represents measurements taken from a patient. There are 216 columns

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 - January 20th 2023 Duration of the exam: 2.5 hours. Exercise 1 Consider the following dataset (Petricoin et al., Lancet, 2002). Each column of A represents measurements taken from a patient. There are 216 columns representing 216 patients, out of which 121 have ovarian cancer. Each row represents the concentration of a different protein in the genomic signature of the patient. You can download the dataset using the following commands in Colab: !wget https://www.dropbox.com/s/bal044f83ezxiia/ovariancancer_obs.csv !wget https://www.dropbox.com/s/r52sn5gmkd3y797/ovariancancer_grp.csv Then you can create the matrix as follows: import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d import Axes3D ovariancancer_obs_path = './ovariancancer_obs.csv' ovariancancer_grp_path = './ovariancancer_grp.csv' A = np.genfromtxt(ovariancancer_obs_path, delimiter=',').transpose() f = open(ovariancancer_grp_path) grp = np.array(f.read().split("\n")) grp = grp[grp != ''] n_features = A.shape[0] n_patients = A.shape[1] print('%d patients' % n_patients) print('%d features' % n_features) 1. Implement the randomized SVD. 2. Perform PCA on the data, by using the exact SVD algorithm. Then, plot the trend w.r.t. i of the singular values σi. Now, repeat the computation by considering the randomized SVD algorithm of rank k = 1 , 5, 10, 50 and 100. Plot the approximate singular values together with the exact singular values. Comment what you see. 3. Use PCA (with exact SVD) to perform dimensionality reduction on the dataset for rank k = 1, 5, 10, 50 and 100. Compute the reconstruction error of the dataset as a function of k. Repeat the same exercise by using the randomized SVD algorithm. Repeat the same exercise by…

Preview

First page of the document.

First page: 20 01 2023 E TS