← Indietro
EserciziDivisi per argomento

3 Linear regression

Divisi per argomento di Machine Learning per il corso di Computer Engineering presso Politecnico di Milano. Materiale proveniente dall’archivio storico Studwiz e classificato per la consultazione online.

Machine LearningDivisi per argomento

Informazioni sul documento

Cosa trovi in questo materiale

Divisi per argomento di Machine Learning per il corso di Computer 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

3 Linear Regression 3.1 Practical Exercises Let us consider the iris_dataset. In the dataset we have data regarding specific species of flowers (Figure 3.1): • Sepal length; • Sepal width; • Petal length; • Petal width; • Species (Iris setosa, Iris virginica e Iris versicolor). in the specific, we haveN = 150 total samples (50 per type). At first, we want to predict the petal width of a specific kind of Iris setosa by using the petal length. This can be considered a regression problem where we consider as feature xn the petal length and as targettn the petal width. In order to provide a prediction ˆtn for the targettn, we will consider: • Hypothesis space: ˆtn =f(xn,w ) =w0 +xnw1; • Loss measure: J(w,xn,tn) =RSS(w) = ∑ n(ˆtn −tn)2; • Optimization method: Least Square (LS) method. wherew ∈ RM,M = 2. 3.1.1 Data Pre-processing We load the data into theMATLAB workspace: 1 load iris_dataset.mat; 1 3 Linear Regression Figure 3.1: Image of an Iris flower. Before even starting the process of analyzing data, one should plot the considered data to inspect them (if possible): 1 figure(); 2 gplotmatrix(irisInputs'); 3 x = irisInputs(3,:)'; 4 t = irisInputs(4,:)'; Once we inspected the data, we should operate some pre-processing procedures. On a generic dataset one should perform: • shuffling; • remove inconsistent data; • remove outliers; • normalize or standardize data; • fill missing data. For instance in the Iris dataset there has been some problem in the transcription of the original dataset and some works has been tested on a different dataset. 1. Thus one might want to remove those data which have been erroneously reported or correct them if the original values are available. In this case, we simply normalize the data (input and target) by using the function zscore() which operates…

Anteprima

Prima pagina del documento.

Prima pagina: 3 Linear regression