Document information
- University
- Politecnico di Milano
- Degree programme
- Computer Engineering
- Subject
- Machine Learning
- Classification
- Exercises · By topic
- Original format
- Text
- Searchable text
Topic-based study materials for Machine Learning in the Computer Engineering degree programme at Politecnico di Milano. The document covers: 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
Topic-based study materials for Machine Learning in the Computer Engineering degree programme at Politecnico di Milano. The document covers: 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
Import quality: text was extracted directly from the original 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.
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…
First page of the document.