Author - Mohit Rathore mrmohitrathoremr@gmail.com - markroxor.in
Licensed under The MIT License - https://opensource.org/licenses/MIT
import numpy as np
from fromscratchtoml.toolbox import binary_visualize
from fromscratchtoml.toolbox.random import Distribution
from sklearn.datasets import load_iris
from fromscratchtoml.cluster import DBSCAN
%matplotlib inline
eps = 0.5
min_points = 5
X = load_iris().data
db = DBSCAN(eps, min_points)
db.fit(X)
binary_visualize(X[:, :2], db.clan)
x1 = Distribution.linear(pts=10, mean=[0, 20])
y1 = np.ones([len(x1), 1])
x2 = Distribution.linear(pts=10, mean=[0, 0])
y2 = -np.ones([len(x2), 1])
x3 = Distribution.linear(pts=10, mean=[2, 10])
y3 = 2*np.ones([len(x3), 1])
X = np.vstack([x1, x2, x3])
Y = np.vstack([y1, y2, y3])
eps = 2
min_points = 2
db = DBSCAN(eps, min_points)
db.fit(X)
binary_visualize(X, db.clan)