0
0
ML Pythonprogramming~10 mins

DBSCAN clustering 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 DBSCAN class from scikit-learn.

ML Python
from sklearn.cluster import [1]
Drag options to blanks, or click blank then click option'
ADBSCAN
BKMeans
CPCA
DLinearRegression
Attempts:
3 left
2fill in blank
medium

Complete 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'
A5
B1.0
C0.5
D0.05
Attempts:
3 left
3fill in blank
hard

Fix 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'
Afit
Bpredict
Ctransform
Dscore
Attempts:
3 left
4fill in blank
hard

Fill 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'
Alabels
Brange
Cfit
Dpredict
Attempts:
3 left
5fill in blank
hard

Fill 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'
Alabels
B-1
Dfit
Attempts:
3 left