0
0
ML Pythonprogramming~10 mins

Principal Component Analysis (PCA) in ML Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the PCA class from scikit-learn.

ML Python
from sklearn.decomposition import [1]
Drag options to blanks, or click blank then click option'
APCA
BLinearRegression
CKMeans
DDecisionTreeClassifier
Attempts:
3 left
2fill in blank
medium

Complete the code to create a PCA object that reduces data to 2 components.

ML Python
pca = PCA(n_components=[1])
Drag options to blanks, or click blank then click option'
A1
B2
C3
D0
Attempts:
3 left
3fill in blank
hard

Fix the error in the code to fit PCA on the data array named 'data'.

ML Python
pca.fit([1])
Drag options to blanks, or click blank then click option'
Afit
Bdataset
Cpca
Ddata
Attempts:
3 left
4fill in blank
hard

Fill both blanks to transform the data and store the result in 'pca_result'.

ML Python
pca_result = pca.[1]([2])
Drag options to blanks, or click blank then click option'
Atransform
Bfit_transform
Cdata
Dpca_result
Attempts:
3 left
5fill in blank
hard

Fill the two blanks to print the explained variance ratio of the first principal component.

ML Python
print(pca.[1][[2]])
Drag options to blanks, or click blank then click option'
Aexplained_variance_ratio_
C0
Dcomponents_
Attempts:
3 left