Reputation: 55
I have been working to create a custom DBSCAN where I can create a custom parameter to filter distances based on Taxi ID to see which taxis are creating a traffic blockage. I have time and distance matrices added but I am stuck on how to create a new eps to filter taxis based on ID. If the eps value is high then different Taix ID should be clustered and if low same taxi. How to proceed?
time_dist = pdist(X[:, 0].reshape(n, 1), metric=self.metric)
euc_dist = pdist(X[:, 1:], metric=self.metric)
# filter the euc_dist matrix using the time_dist
dist = np.where(time_dist <= self.eps2, euc_dist, 2 * self.eps1)
db = DBSCAN(eps=self.eps1,
min_samples=self.min_samples,
metric='precomputed')
db.fit(squareform(dist))
self.labels = db.labels_
Upvotes: 0
Views: 55