With the code below load the mnist digits data set and apply PCA
to extract principle components responsible for a)70%, b)80%,and
c)90% of variance. Apply a RandomForest(max_depth=3) algorithm to
the components in a), b), and c). Report how the accuracy scores
vary with the amount of variance explained.
Code for load the mnist digits data set:
from sklearn.datasets import fetch_openml
mnist = fetch_openml('mnist_784', version=1)
mnist.keys()
from sklearn.model_selection import train_test_split
X = mnist["data"]
y = mnist["target"]
X_train, X_test, y_train, y_test = train_test_split(X, y,
random_state=42)
With the code below load the mnist digits data set and apply PCA to extract principle components responsible for a)70%,
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
With the code below load the mnist digits data set and apply PCA to extract principle components responsible for a)70%,
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!