-1
$\begingroup$

I'm new to DBSCAN. I was looking at a few examples online and came across a few instances where the following lines were used while importing the dbscan module:

from sklearn.cluster.dbscan_ import DBSCAN
from sklearn.cluster.dbscan_ import dbscan

I would like to know if there is anything different between them? Or is it necessary for me to import both DBSCAN and dbscan?

Here's one link where both lines are used in the import: https://gemfury.com/stream/python:scikit-learn/-/content/cluster/tests/test_dbscan.py

$\endgroup$
0
$\begingroup$

Such questions are easily answered if you check the source code yourself.

https://github.com/scikit-learn/scikit-learn/blob/1495f69242646d239d89a5713982946b8ffcf9d9/sklearn/cluster/dbscan_.py#L350

One is an object-oriented wrapper with a more common API, the other the underlying function that does the actual work. Since the wrapper just calls the function, the results are not substantially different, only the presentation.

Hence, usually you won't need both.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.