MATLAB - Data Analysis - K-Means Clustering - Report Writing Assignment Help

Download Solution Order New Solution
Internal Code: 1ABHEC

MATLAB Assignment Help

Task: 1 Analysing data A description of the wine data can be found from the link: http://archive.ics.uci.edu/ml/ datasets/Wine?ref=datanews.io. The data that you have been given is the results of a chemical analysis of wines grown in the same region in Italy but derived from three different cultivars. You need to download the data. Note that the first column in the data file is the class label, rather than an attribute (feature). You can assume that the data is of satisfactory quality and requires no preprocessing / data cleansing other than normalisation.
  • Part 1. PCA Analysis on the Wine Dataset
  1. Pre-process the data appropriately ready for a PCA.
  2. Perform a PCA analysis to extract the first two components using the MAT-LAB based toolbox –Netlab.
  3.  Draw the data in the PC1 and PC2 projection and label the data in the picture according to its class.
  • Part 2. K-Means Clustering
  1. Using the same pre-processed data (as in 1.) perform a K-Means clustering of the data using both 5 and 3 codevectors.
  2. Report the quantisation error of using 5 and 3 codevectors, and select the suitable number of codevectors based on these two quantisation errors.
  3. Add the codevectors selected from item 5 (Part 2) to the projection plot of the PCA, and color the points in the PCA picture according to the cluster it is in.
  • Part 3. Write a short critical analysis and summary of the results you have obtained (no more than 100 words). How well does the projection capture the structure in the data? How well do the clusters found represent the classes of the data? Feel free to analyse the data however you feel most suitable. (2 marks)
Task: 2 In this task, you need to perform image compression using PCA to a fishing boat image (boat.512.tiff): As you have learnt from our lecture, projected data in the PCA space can be com- puted using projected data = normalised data × principal components. If we need to transform this projected data back to the original basis, what we can do is to compute orig data = projected data × (principal componenets)T. Therefore, we can recover the dimensions of the original data matrix and obtain orig data. Since the orig data can be calculated as the product of two smaller matrices, projected data and principal components, it suggests a possible method for image compression. You may use imread, imagesc and colormap to read and show the image in MAT- LAB. MATLAB will read the image into a 512 × 512 data matrix containing the pixel information. You need to apply PCA to this data matrix.
  1. Download the image and pre-process the image data appropriately ready for a PCA.
  2. Use MATLAB to perform a PCA analysis to extract the principal components for the image data.
  3. Recover the image using the first 4, 10 and 15 principal components, respectively.
  4. Write a short critical analysis and summary of the results you have obtained (no more than 100 words). How do you decide how many principal components you should use to compress the image? 
Data classification You have been given one MATLAB data file (wine.mat) on Canvas including, a training data matrix, a testing data matrix, and corresponding class labels (3 classes). You have applied PCA on the original wine dataset in Task 1. The training set you have been given consists of 118 instances. The testing set contains 60 instances. Task: 3 - Classification using SVM  To do this task, you need to download two files from Studynet first: trainingSet.dat and testingSet.dat. Both files are in the LibSVM format.
  • Normalisation (1 mark) The data you have been given is raw data. It has not been normalised (scaled). Normalising data is very important when using SVMs as it stops attributes with a large numeric range from dominating the classification model. Your task is to use ‘svm-scale’, one of the functions provided in LibSVM, to normalise both data sets. You should normalise all attributes in the range of ?1 to +1 (the ‘svm-scale’ defaults).
  • Cross validation (3 marks) When using the C-SVC (Support vector classification) with the Gaussian radial basis kernel there are two tunable parameters, C (cost) and ? (gamma). To achieve the highest classification rate possible it is very important to search for an optimal pair of these values. You have been given three combinations: [C=100, ?=5], [C=10, ?=3] and [C=5, ?=0.3]. You need to carry out a five-fold cross validation on the training data set for each combination of C and ? from the given 3 combinations. You need to re- port the cross validation accuracy for each combination. Then select the optimal combination out of the 3 given combination and report your results.
  • Classification (2 marks) You should now be in a position to classify the test data. This will involve using LibSVMs ‘svm-train’ and ‘svm-predict’, both command line applications. With the normalised training set as the input file, you will need to use ‘svm-train’ with the suitable parameter values discovered for C and ? during cross validation. When the classification model is built you will then need to use it with ‘svm- predict’ to classify the normalised testing set. For help using these command line applications simply run them from a terminal / command prompt window with no arguments.
Task: 4 - Classification Analysis 
  • Can you find instances misclassified by SVM? You should write a MATLAB pro- gram to do this for you. Using the output file of ‘svm-predict’, map the classifi- cations made back to the original instances. The order of the predictions in the output file is the same as the order of the instances in the testing data set. See if you can locate all of the instances that were misclassified as you did in Task 3. 
  • Can you draw the misclassified instances (instances misclassified by SVM) in the training data’s PCA space? Remember to use different color to label instances. 
  • Can you find any reason/reasons as to why you think these instances were mis- classified? Feel free to analyse the data however you feel most suitable.
Feature reduction and hierarchical clustering Task: 5 - This task needs to be done in R From the PCA carried out in Task 1, Part 1 print out the eigenvalues. They should be ordered from the highest to the lowest value and sum up to the total number of original features. Expressed as a percentage of this sum (which is 13), the eigenvalues represent the amount of the variance in the data taken up (or explained) by the first, second, ..., thirteenth principal component (PC).
  • Produce a Scree Plot. This is a line plot of the percentage of the total variance accounted for the first to the last PC. Alternatively, you could plot the cumulative percentage represented by the PCs. 
  • From the plot determine the number of PCs that are needed to account for (al- most) 75% of the variance.
In the first Task (Task 1) you were asked to concentrate on just the first two PCs. This was handy, because it allows you to plot the results in a simple two- dimensional plot. The drawback is that it might not capture a sufficient amount of the variance in the data.
  • From the scree plot, the table of eigenvalues or a plot of the cumulative percentage assess how much of the variance is explained by the first two PCs. 
To visualize the results of a PCA accounting for 75% of the variance, one obviously needs a higher dimensional space. One way around this is to cluster the 175 observations using the PCs representing 75% of the variance as features.
  • Produce a dendrogram by performing a hierarchical cluster analysis (similarity metric = Euclidean Distance, cluster criterion = Wards Average). 
Compare the result of the hierarchical cluster analysis with the two-dimensional PC plot of task 1 (part 1) and the k -means clustering of task 1 (part 2). What is the advantage of the hierarchical cluster analysis over the k means method? 
This MATLAB Assignment has been solved by our MATLAB  experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.