Complete the code to import the t-SNE class from scikit-learn.
from sklearn.manifold import [1]
The correct class name for t-SNE in scikit-learn is TSNE with uppercase letters as shown.
Complete the code to create a t-SNE object with 2 output dimensions.
tsne = TSNE(n_components=[1])For visualization, t-SNE is usually set to 2 components to reduce data to 2D.
Fix the error in the code to fit and transform data using t-SNE.
X_embedded = tsne.[1](X)t-SNE requires fit_transform to both fit the model and get the transformed data in one step.
Fill both blanks to create a scatter plot of the t-SNE results with colors.
plt.scatter(X_embedded[:, [1]], X_embedded[:, [2]], c=labels, cmap='viridis')
For 2D t-SNE output, the first dimension is column 0 and the second is column 1.
Fill all three blanks to create a dictionary comprehension that maps each label to the count of points with that label.
label_counts = {label: sum(1 for x in labels if x [1] label) for label in set(labels) if label [2] 0 and label [3] -1}The comprehension counts points where label equals the current label (==), filters labels greater than 0 (>), and excludes label -1 (!=).