# DBSCAN input format? [closed]

just trying to understand the process of removing outliers in my data using the python Scikit's DBSCAN function.

As an example, given aDataFrame of data, which includes both my target and features, I do the following:

#Remove outliers
DB = DBSCAN(eps=0.5, min_samples = 10)
print (Counter(DB.labels_), '\n')


I'm seeing about 50% of my data removed as outliers, where I'd guess typically you'd see about 5% as outliers. (So I must be doing something wrong).

Should targets(labels) be included in the data passed to DBSCAN? Are there rule of thumbs you use when choosing good values for DBSCAN parameters?

## closed as unclear what you're asking by Nick Cox, kjetil b halvorsen, Peter Flom♦Mar 24 '18 at 13:58

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• For outlier detection, you should rather use an outlier detection approach like Local Outlier Factor, or LoOP, or kNN outlier. LOF is by the DBSCAN authors, based on similar ideas but better at this task than clustering 'leftover' noise points. – Anony-Mousse Mar 24 '18 at 19:51
• Apart from that, just increase epsilon to get less noise. – Anony-Mousse Mar 24 '18 at 19:51

Take a look at the distribution of pairwise distances. If 90% of your pairwise distances are 1 or larger, then setting eps=0.5 will guarantee that few if any clusters are found. Similarly, consider the size of your dataset and likely numbers of clusters when setting min_samples.