jasonlaska / spherecluster

Clustering routines for the unit sphere
https://medium.com/@jaska_at_clara/simple-datetime-disambiguation-fd2374ce664a
MIT License
331 stars 78 forks source link

VMF scaling denominator was inf #10

Open rana-alshaikh opened 6 years ago

rana-alshaikh commented 6 years ago

Hi I tried to run the soft version, and this error appears 'VMF scaling denominator was inf'. what could be the reasons for that. Another question is there any way to estimate the number of the clusters.

Thanks

jasonlaska commented 6 years ago

It would be great to know a bit about the data you're working with. That exception is raised when the dimension is too large.

ivarru commented 5 years ago

I experience the same problem when the dimension is relatively low. For example, the test test_integration_dense in test_von_mises_fisher_mixture.py raises this exception most of the time if I let n_features = 10 (and fixes params_in to {"posterior_type": "soft"}).

itamar-dw commented 4 years ago

see my comment here https://github.com/jasonlaska/spherecluster/issues/17 EDIT It is actually straight forward to work in log scale using the exponentially-scaled modified Bessel functions:

from numpy import i0e  # exp-scaled modified Bessel function of first kind order 0, I_0                                                                                                                               
from scipy.special import ive  # exp-scaled modified Bessel function of first kind, I_v   
jasonlaska commented 4 years ago

Thanks @itamar-dw would you like to add a PR for this change?

itamar-dw commented 4 years ago

sure. I tried to create a new branch and push it, but I got:

remote: Permission to jasonlaska/spherecluster.git denied to itamar-dw

jasonlaska commented 4 years ago

@itamar-dw I saw one branch come up but it was derived off of master. Could you try branching off develop (pull the latest develop first or rebase), then tag me on the PR? I will merge it in after testing and reviewing.

You should be able to submit a PR for this project via the github UI by forking to your own account first https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project

Let me know if you need help.

jasonlaska commented 4 years ago

Alternatively, I'm happy to cherry-pick from a gist, if that's easier.

itamar-dw commented 4 years ago

Yes I created a PR then I realized I have to create a branch first. I'll do it as you suggested, that's an opportunity to learn how to do it :)