[SOLVED] IR-Assignment #3

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Assignment3-83shg9.zip (311.8 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
πŸ”’ Securely Powered by:
Secure Checkout
5/5 - (1 vote)

Β 

Information Retrieval in High Dimensional Data

Β 

Β 

Please hand in your solutions via Moodle. Use the attached Jupyter notebook.

Solutions must be handed in by groups. Please state the names of your group members at a prominent place in your submission. (For example, at the beginning of your provided notebook or in a separate text file.)

The Kernel Trick

Task 1: [25 points] On Moodle you will find a Jupyter-Notebook that contains a function for dimensionality reduction via PCA. The function linear_pca expects a data matrix X ∈ RpΓ—N and a number of PCs k and returns the first k PCA scores for the matrix X.

  • Provide code that tests the function with selected images from the provided MNIST training dataset by visualizing the first 2 scores in a scatter plot.
  • Complete the function gram_pca such that it has the same functionality as linear_pca but expects a gram matrix K = X>X instead of the data matrix X as its input. Do not assume that K was produced from centered data. Note: It is important to be consistent in notation here. E.g., for a data matrix of 1000 MNIST images, we have X ∈ R784Γ—1000 and K ∈ R1000Γ—1000.
  • Test your implementation and show that gram_pca(dot(X.T,X), k) yields results equivalent to those of linear_pca(X, k).
  • There is as an unknown vector space H, equipped with an inner product hΒ·,iH and a function

Ο• : Rp β†’ H,

such that

holds for every x,y ∈ Rp. The expression on the right-hand side of the equation is called the Gaussian kernel and Οƒ is a parameter to choose by hand.

The function gaussian_kernel_pca expects a data matrix X, a reduced dimension number k and a parameter Οƒ. It returns the first k Kernel PCA scores of the data. In other words, the function returns the first k PCA scores of

Ο•(x1),Ο•(x2),…,Ο•(xN),

where xi denotes the i-th data sample/i-th column of the data matrix. The function gaussian_kernel_pca is already written, but for it to work, the function compute_gaussian_gram_matrix must return correct results. Complete compute_gaussian_gram_matrix accordingly.

  • Test gaussian_kernel_pca with some MNIST train images and Οƒ = 1000.
  • Assignment3-83shg9.zip