You are on page 1of 2

AIM : dbscan algorithm implementation

THEORY:Density-Based Clustering Algorithms


Density-Based Clustering refers to unsupervised learning methods that identify distinctive
groups/clusters in the data.Density-Based Spatial Clustering of Applications with Noise
(DBSCAN) is a base algorithm for density-based clustering. It can discover clusters of different
shapes and sizes from a large amount of data, which is containing noise and outliers.
The DBSCAN algorithm uses two parameters:

minPts: The minimum number of points (a threshold) clustered together for a region
to be considered dense.
eps (ε): A distance measure that will be used to locate the points in the neighborhood
of any point.

PROGRAM : import numpy as np


import matplotlib.pyplot.plt
from sklearn.cluster import DBSCAN
x1 = np.array([3, 1, 1, 2, 1, 6, 6, 6, 5, 6, 7, 8, 9, 8, 9, 9, 8])
x2 = np.array([5, 4, 6, 6, 5, 8, 6, 7, 6, 7, 1, 6, 1, 2, 3, 2, 3])
plt.scatter(x1, x2)
plt.title('Dataset')
plt.xlabel(‘x1’)
plt.ylabel(‘x2’)
plt.show()

X = np.array(list(zip(x1, x2))).reshape(len(x1), 2)
print(X)
dbscanobj = DBSCAN(eps=2,min_samples=3)
dbscanobj.fit(X)
OUTPUT:

You might also like