Assignment Task:
Task:
Introduction
Ins Coursework All allow you to explore some topics that are covered in this week’s lecture.
Before starting you are required to have: 1. access to MATLAB or python (instructions for running MATLAB and python are available on the modules KEATS webpage). 2. familianty with the MATLAB or python programming language (links to general introductory tutorials are available on the modules KEATS webpage.).
Training Data
Some of the exercises in this coursewol k requite you to use the Iris dataset. This dataset contains 150 samples from 3 classes. Each sample is a fourdimensional feature vector This data can be obtained as follows.
In MATLAB:
Download the file ins_claSs1_2_3_40.mat from the module’s KEATS webpage. Load this dataset into MATLA8 using the following command: toad(‘ :tit..< 1.0_2_1_4D…I ). This will produce two variables, X and t. Each column of X rs a feature vector for one sample. The class label associated with each sample is given by the corresponding element of vector ti
In python: Use the following commands: fro. .1, loan. 1490.1 tiotnet iris datacets. loaduit0 The structure ins’ contains a field Ins.data that is an array, each row of which is a feature vector for one sample, and a field ins.target that is a vector defining the class labels associated with the corresponding rows of iris.data.
Assessment
Ihts coursework is assessed. Pressing the ‘Check” button In each section submits your answers for that section. Once you have submitted, you can not go back and alter your answer: YOU HAVE ONE ATTEMPT TO ANSWER EACH QUESTION.
Need Help Writing an Essay?
Tell us about your assignment and we will find the best writer for your paper.
Get Help Now!Question 1
Not complete Marked out of 3.00 ‘ Flag question
Principal Components Analysis
In the Iris dataset each sample is represented by a foupdimensional feature vector. k is difficult to vnualise 4d data. One way to do it is to apply Principal Components Analysis to reduce the &mensionality of the data. If you plot the Iris data projected onto the first two priscipal components you should get a result ‘We that shown in the Introduction section.
Perform Principal Components Analysis on the Ins Dataset (see the Introduction for instructions on how to obtain this dataset You can do this by hand, using the Karhunen.Loove Transform, but it is very laborious (and you will still need to use a function, such as “et in MATLAB, to calculate the eigenvalues and eigemectors). Akematively, you can use MATLAB or python to implement the Karhune•toive Transform, or use the inbuik function called ‘pca’ in MATLAS, or the function called1)CW from the skleam.decomposkion library in python.
Using the projection coefficients that you have calculated for the Iris detest( project the following feature vectors onto the first two principal components.
Sample number Feature vector, xr
1 (6.3, 4.1, 5.2, 0.9) 2 (5.2, 3.0, 5.6. 1.7) 3 (6.6, 2.5, 2.5, 1.6) 4 (5.2, 2.2, 2.0, 2.3) 5 (5.0, 3.0, 2.2, 1.8)
Question 2 Not complete Marked oc of S.00 r flag question
Sparse Coding
The are many different aigonttrns that can be used to calculate a sparse code. In this exercise we will use a method called ‘Orthogonal Matching Pursuit’ (OMP). This method is available in MATLAB and python. For MATLAB dowrioad the file called sparse encode_OMP.m from the module’s KEATS webpage, and place this file in a directory on your MATLAB path. For python it is implemented by the “sparsefincode” function from the sIdeam.decomposthon Ibrary.
If you have a dictionary v and a sample x, the sparse coefficients for that sample can be cak-ulated as follows: In MMUS yrsperte.eoucle_CPP(V,x,ouelocZeto,toletance), In python rsparse.encodo(x,V,II:goritle.’asp’enitorm.fo_coef s.luthaq.ro,alphs-tolormus) In both cases the pararnecers should be set to: runorszero.2 tolerante.1.000000*•05
Note that both the MATLAB and python functions can determine the sparse coefficients for multple samples at once, if xis a matnx rather than a vector.
For each class defne a class-specific dictionary containing all the samples from the Iris dataset that ate in that class. Using the method described above, encode each of the following samples using these 3 class-specific dictionaries. Sample number Feature vector, xr 1 (5.7, 3.6, 2.7. 1.81
Welcome to Our Online Academic Writing Service. Our online assignment writing website provide various guarantees that will never be broken. No matter whether you need a narrative essay, 5-paragraph essay, persuasive essay, descriptive essay, or expository essay, we will provide you with quality papers at student friendly price.
Ask for Instant Writing Help. No Plagiarism Guarantee!


