Page 1 of 1

With the code below load the mnist digits data set and apply PCA to extract principle components responsible for a)70%,

Posted: Sun May 15, 2022 8:02 am
by answerhappygod
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)