Question 17
Consider the following code snippet:
from sklearn.pipeline import Pipelinefrom sklearn.preprocessing import StandardScalerfrom sklearn.decomposition import PCAfrom sklearn.impute import SimpleImputer
pipe = Pipeline([('impute', SimpleImputer(strategy='most_frequent')), ('scale', StandardScaler()), ('reduce', PCA(n_components=2))])
data = np.array([[3, np.nan, 5], [1, 2, np.nan], [np.nan, 4, 6]])
transformed_data = pipe.fit_transform(data)How many components does the PCA reduce the data to, after transformation?
2
3
1
None of these