← Indietro
EsameEsame completoTesto d’esame

08 07 2021 E TS

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 8th 2021 Duration of the exam: 2.5 hours. Exercise 1 Let us consider a database containing the relative consumption of certain food items in European countries. The numbers represent the percentage of the population consuming that food type. import pandas as pd import numpy as np import matplotlib.pyplot as plt data = pd.read_csv(’https://openmv.net/file/food-consumption.csv’).fillna(0) data data.describe() A = data.to_numpy()[:,1:].T.astype(np.float64) countries = data.to_numpy()[:,0] foods = np.array(data.columns[1:] Each column of the matrix A refers to a country, and each row represents a specific food. The arrays countries and foods contain the list of countries and foods, respectively. ˆ How many samples and features are there in the dataset? ˆ Perform PCA on the dataset by means of the SVD decomposition. Then, plot the trend of – the singular values σk; – the cumulate fraction of singular values ∑k i=1σi∑q i=1σi ; – the fraction of the “explained variance” ∑k i=1σ2 i∑q i=1σ2 i ; ˆ Print the first two principal directions. Which are the more important foods for these two directions? Knowing that mediterranean cuisine envisages a large use of garlic and olive oil, compared to the European average, do you expect a positive or negative 1st principal component for Italy? ˆ Print the first two principal components. Based on these results: – In which European region do you expect a large consume of crisp bread? Why? Is this confirmed by the original data? – Which countries have food habits that are similar to Italy? – Based on the two first principal components, what do you expect about the food habits in England? Is this confirmed by the original data? Exercise 2 Consider the data provided in file…

Anteprima

Prima pagina del documento.

Prima pagina: 08 07 2021 E TS