giotto-ai / giotto-tda

A high-performance topological machine learning toolbox in Python
https://giotto-ai.github.io/gtda-docs
Other
851 stars 174 forks source link

No module named 'sklearn.cluster._hierarchical' #330

Closed saramasarone closed 4 years ago

saramasarone commented 4 years ago

Hi 😊,

I'm trying to import the packages as listed on "tutorial_mapper/Christmas Mapper.ipynb" but it fails to do so. I know for sure that my sklearn package works, since I use it every day. Is there any chance that sklearn has changed the name of the clustering modules and therefore it fails to import the required packages?

I attach the pics of the error it throws:

Screenshot 2020-02-26 at 11 27 41 Screenshot 2020-02-26 at 11 27 49

Do you have any suggestion on how could I fix this problem?

Thank you, Sara

WeilerP commented 4 years ago

Hi Sara, thank you for your feedback! The problem should indeed be the version of scikit-learn. The current implementation on the master branch requires scikit-learn==0.22.0 and not scikit-learn>=0.22 as the README suggests. I ran the notebook in a clean environment with scikit-learn==0.22.0 and it works. Please let us know if this solves your problem.

@wreise, is there a reason why the merge request updating the notebook to the new API has not yet been merged? This would resolve the problem once and for all.

ulupo commented 4 years ago

Hi @saramasa22, and thanks for the interest! As @WeilerP pointed out, the problem is due to the fact that we had not got round to updating the repo to the new version (and name!) of the library. Note that the library is now called giotto-tda (not giotto-learn) and that the main module is called gtda (and not giotto).

We just merged https://github.com/giotto-ai/tutorial_mapper/pull/8 and the Christmas Mapper repo has been updated to work with the latest version of giotto-tda. Please let us know if that still does not work for you.

Please make sure you first uninstall giotto-learn and giotto-learn-nightly!

saramasarone commented 4 years ago

Hi, and thank you for the prompt reply! I did uninstall giotto-learn and giotto-learn-nightly and I installed the gtda package but I still get some errors during the run. The first part runs smoothly but then it seems like it can't find the module called "plotting", the FilterFunctionName and CoverName. Do I need to import any additional package to ones listed in the notebook?

Screenshot 2020-02-26 at 13 40 38
ulupo commented 4 years ago

Thanks for the feedback @saramasa22. Your last screenshot doesn't look to me like it's coming from tutorial_mapper/Christmas Mapper.ipynb. It looks like it's coming from giotto-tda/examples/mapper_quickstart.ipynb. The former is in a separate repository from the giotto-tda one, made just for the blog post/use case on Santa Claus, while the latter is in the examples folder of this repository, and requires another module in that folder, called plotting.py, to be present in the same directory.

ulupo commented 4 years ago

In giotto-tda/examples/mapper_quickstart.ipynb, we should point out that plotting.py is needed!

ulupo commented 4 years ago

Update: I am now advocating for replacing the import statement involving plotting.py, and using vanilla plotly code instead. See #332.

ulupo commented 4 years ago

@saramasa22 since we merged #332, you should have fewer things to do to make the mapper_quickstart notebook work. Additionally, the Christmas Mapper notebook should also now be fixed to work with the latest stable version of giotto-tda. Could you let me know if you still experience issues?

saramasarone commented 4 years ago

It does work! Thank you!!