I have an array of coordinate data (in Web Mercator Eastings and Northings, thus in metres) that looks like this:
array([[ -232372.201264, 6785082.61011 ],
[ -233396.451899, 6784865.49884 ],
[ -234045.110572, 6784642.2575 ],
...,
[ -234473.356653, 6778646.81953 ],
[ -234918.300657, 6778772.69366 ],
[ -230900.668915, 6778369.2902 ]])
This array is stored as the variable 'coords'.
I am attempting to compute - and then plot - the clusters within this dataset using Scikit Learn and DBSCAN (thanks to this post for getting me this far).
The code I am using is taken from this tutorial, however I get an attribute error. Code and error shown below:
db = DBSCAN(eps=0.2, min_samples=1, metric="precomputed")
cluster_labels = db.labels_
num_clusters = len(set(cluster_labels))
clusters = pd.Series([coords[cluster_labels == n] for n in range(num_clusters)])
print('Number of clusters: {}'.format(num_clusters))
...
AttributeError: 'DBSCAN' object has no attribute 'labels_'
Can anyone explain where I'm going wrong?