Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
2fill in blank
mediumComplete 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'
Attempts:
3 left
3fill in blank
hardFix 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'
Attempts:
3 left
4fill in blank
hardFill 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'
Attempts:
3 left
5fill in blank
hardFill 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'
Attempts:
3 left