4. PC with images. A dataset has 1000 images of size 28 x 28, represented as python array x with shape (1000, 28 , 28). You are given the following python functions: Y = reshape (X, shape) рса %3D...


4. PC with images. A dataset has 1000 images of size 28 x 28, represented as python array x<br>with shape (1000, 28 , 28). You are given the following python functions:<br>Y = reshape (X, shape)<br>рса %3D РCА(n-components<br># Reshapes X to a shape<br>nc)<br># Creates a PCA object<br>рса. fit(Y)<br># Finds the mean and PCs from training data Y<br>Z = pca.transform (Y)<br>= pca.inversc.transform (Z)<br># Find coefficients in the PC basis<br>Yhat<br># Invert the PC transform<br>Write a few lines of python code to (i) fit a PC model from the first 500 images with 5<br>components; and (ii) create an array of approximations of the remaining 500 images.<br>

Extracted text: 4. PC with images. A dataset has 1000 images of size 28 x 28, represented as python array x with shape (1000, 28 , 28). You are given the following python functions: Y = reshape (X, shape) рса %3D РCА(n-components # Reshapes X to a shape nc) # Creates a PCA object рса. fit(Y) # Finds the mean and PCs from training data Y Z = pca.transform (Y) = pca.inversc.transform (Z) # Find coefficients in the PC basis Yhat # Invert the PC transform Write a few lines of python code to (i) fit a PC model from the first 500 images with 5 components; and (ii) create an array of approximations of the remaining 500 images.

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here