0
0
ML Pythonprogramming~10 mins

Dimensionality reduction visualization 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 library used for dimensionality reduction visualization.

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

Complete the code to create a TSNE object with 2 components for visualization.

ML Python
tsne = TSNE(n_components=[1], random_state=42)
Drag options to blanks, or click blank then click option'
A2
B3
C10
D1
Attempts:
3 left
3fill in blank
hard

Fix the error in the code to fit and transform the data using TSNE.

ML Python
X_embedded = tsne.[1](X)
Drag options to blanks, or click blank then click option'
Afit_transform
Btransform
Cfit
Dpredict
Attempts:
3 left
4fill in blank
hard

Fill both blanks to create a scatter plot of the 2D TSNE results with labels.

ML Python
plt.scatter(X_embedded[:, [1]], X_embedded[:, [2]], c=labels, cmap='viridis')
plt.xlabel('Dimension 1')
plt.ylabel('Dimension 2')
plt.title('TSNE Visualization')
plt.colorbar()
Drag options to blanks, or click blank then click option'
A0
B1
C2
D3
Attempts:
3 left
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps each label to its count in the dataset.

ML Python
label_counts = [1] [2] for [3] in set(labels)}
Drag options to blanks, or click blank then click option'
A{label
Blabels.count(label)
Clabel
D[label
Attempts:
3 left