Question: Using Python implement the follo Question 1 We now need to identify the principal components. For this we need to compute a covariance matrix and
Using Python implement the follo
Question 1 We now need to identify the principal components. For this we need to compute a covariance matrix and then determine its eigenvalues and eigenvectors. Sort these in ascending order and pick the first l largest eigenvalues and their corresponding eigenvectors. These become the principal components. There are two ways to determine principal components. Let's investigate both ways.
a. Use the Numpy package to determine the covariance matrix, and work out its eigenvalues and eigenvectors.
b. Alternatively, for l>1, the covariance matrix is given by the l eigenvectors of XT X corresponding to the largest eigenvalues. We can derive the principal components via singular value decomposition of XT X.
c. Is there any relationship between the features in X ? What does it mean when features are highly correlated?
Task 3: Reduce the data
Question 1 Sort the eigenvalues and their corresponding eigvenvectors in descending order.
Question 2 Select the first l principal components, i.e., select the first l eigenvectors and concatenate all them to form a matrix V with one eigenvector per column: V=[v(1),...,v(l)).
Question 3 Transform the original dataset from n dimensions to l dimensions with the following matrix multiplication XV.
Question 4 Reconstruct the original data from the reduced data set using V . What do you observe in terms of the norm?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
