Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the DBSCAN class from scikit-learn.
ML Python
from sklearn.cluster import [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to create a DBSCAN model with epsilon 0.5.
ML Python
model = DBSCAN(eps=[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 the DBSCAN model on data X.
ML Python
model = DBSCAN(eps=0.3) model.[1](X)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to create a dictionary of cluster labels for each point in X.
ML Python
labels = model.[1] clusters = {i: labels[i] for i in [2](len(labels))}
Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to compute the number of clusters excluding noise points.
ML Python
import numpy as np unique_labels = set(model.[1]) num_clusters = len(unique_labels) - (1 if [2] in unique_labels else 0) noise_points = np.sum(model.[3] == -1)
Drag options to blanks, or click blank then click option'
Attempts:
3 left