GithubHelp home page GithubHelp logo

Comments (5)

thomasht86 avatar thomasht86 commented on May 18, 2024 6

I know this is an old thread, but thought I would chime in anyway. The haversine metric requires radians instead of lat/lon, and so the epsilon also have to be calculated as meters / metersperradian. If we want an eps that corresponds to 2000m, we need to input:
ms_per_radian = 6373000.0
eps = 2000 / ms_per_radian

For the lat/lon-data, the simplest is to just convert to radians by using:

X = np.radians(X)

from hdbscan.

lmcinnes avatar lmcinnes commented on May 18, 2024

It is quite possible you are not doing anything wrong. I've had some private reports of weirdness with Haversine. In reflection I suspect that perhaps it doesn't play well with the Boruvka algorithm given it's presumption of a compact manifold which I'm not sure Boruvka is going to handle in quite the way one would expect. To test that theory you could try:

hdb = HDBSCAN(min_cluster_size=3, metric='haversine', algorithm='prims_balltree').fit(sample_data)
hdb_labels = hdb.labels_
n_clusters_hdb_ = len(set(hdb_labels)) - (1 if -1 in hdb_labels else 0)

and see if that gives more sensible results. I suspect it may. If it does then I'll have to add some checks to ensure Haversine uses Prims. If it doesn't ... Haversine may just be broken. I'll have to look into it further.

from hdbscan.

lmcinnes avatar lmcinnes commented on May 18, 2024

from hdbscan.

iremozen-edremit avatar iremozen-edremit commented on May 18, 2024

I know this is an old thread, but thought I would chime in anyway. The haversine metric requires radians instead of lat/lon, and so the epsilon also have to be calculated as meters / metersperradian. If we want an eps that corresponds to 2000m, we need to input:
ms_per_radian = 6373000.0
eps = 2000 / ms_per_radian

For the lat/lon-data, the simplest is to just convert to radians by using:

X = np.radians(X)

Thanks, that's actually very helpful!

On Fri, Mar 10, 2017 at 2:52 AM, thomasht86 @.***> wrote: I know this is an old thread, but thought I would chime in anyway. The haversine metric requires radians instead of lat/lon, and so the epsilon also have to be calculated as meters / metersperradian. If we want an eps that corresponds to 2000m, we need to input: ms_per_radian = 6373000.0 eps = 2000 / ms_per_radian For the lat/lon-data, the simplest is to just convert to radians by using: X = np.radians(X) — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#29 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/ALaKBfG7t4MgRNucHVSuVwRLQXS7AoJgks5rkQEtgaJpZM4H0v9V .

however, eps cannot be applied on HDBSCAN algorithm. This usage is only for DBSCAN. is it right?

from hdbscan.

lmcinnes avatar lmcinnes commented on May 18, 2024

Yes, eps is not relevant in this case, but the conversion to radians remains important.

from hdbscan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.