Question: Load the same data. Extract 1000 observations, use the code below. Try five different PCA alogrithms that would extract 100 principle components. Use the following
Load the same data. Extract 1000 observations, use the code below. Try five different PCA alogrithms that would extract 100 principle components. Use the following PCA algorithms: PCA, Kernel PCA(Linear), LLE (10 neighbors), Isomap. Then estimate logistic regression on the training data and test the accuracy using testing data.
- What are the accuracy score on testing data you find with each PCA algorithm?
- Which PCA algorithm has the highest prediction accuracy?
- What is the accuracy of the logistic regression applied to the 1000 obs without applying PCA?
the given code:
# Randomly sample 1000 obs, otherwise it will get really slow.
np.random.seed(42)
smp = np.random.randint(50000, size=1000)
X_s = mnist["data"][smp,:]
y_s = mnist["target"][smp]
X_train_s, X_test_s, y_train_s, y_test_s = train_test_split(X_s, y_s)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
