jasonlaska / spherecluster

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

AttributeError: 'SphericalKMeans' object has no attribute '_check_fit_data' #13

Closed vrk7bp closed 5 years ago

vrk7bp commented 6 years ago

I've been getting a AttributeError: 'SphericalKMeans' object has no attribute '_check_fit_data'

error every time I try to run a SphericalKMeans fit. Diving a little further, it looks like the _check_fit_data method only exists in two locations in the repository...

Line 318 in spherical_kmeans.py (the line that throws the error in this case).

Line 772 in von_mises_fisher_mixture.py where it seems to be a defined method.

Based on what I can see from the imports, it looks like the _check_fit_data doesn't actually exist in the context of spherical_kmeans.py, so the error kind of makes sense.

Could this be the result of some accidental deletions? I went through the commit history and couldn't find anything that immediately seemed like the issue. Or is there something very obvious that I'm missing... wouldn't be the first time :)

Also as an FYI, I'm running Python 3.6.4.

vrk7bp commented 6 years ago

In the mean time I've started running some VonMisesFisherMixture fits with no issue.

jasonlaska commented 6 years ago

Its possible that you are using a newer version of sklearn than this implementation expects. I'll look into a path to upgrading/simplifying it.

vrk7bp commented 6 years ago

Yep, I think you hit the nail on the head. I was running sklearn version 0.20.0. I looked at your requirements.txt and saw that the bare minimum was 0.19.0, so downgraded my local version and things seem to be going fine.

Thanks for the help (and the late night reply)! I'm a big fan of spherecluster, so thanks for putting this together and sharing.

jasonlaska commented 5 years ago

This has been updated, you can grab the latest (0.1.7) at https://github.com/jasonlaska/spherecluster/releases/tag/0.1.7 or from pypi.