Parietal-INRIA / DiFuMo

Dictionary of Functional Modes for brain imaging
https://parietal-inria.github.io/DiFuMo
23 stars 5 forks source link

Fix broken import from pre-0.22.0 sklearn #15

Closed RaphaelMeudec closed 3 years ago

RaphaelMeudec commented 3 years ago

This PR fix a broken import (sklearn.datasets.base) which occurs in the demo.ipynb for scikit-learn >=0.22.0.

Why the broken import

base isn't exposed in sklearn since 0.22.0 so the available code is runnable only with <0.22.0.

How I fixed it

sklearn.datasets.base imports Bunch from sklearn.utils so I just switched the Bunch import from sklearn.datasets.base to sklearn.utils. I didn't have to fix the scikit-learn version in the requirements.

Addition

I fixed the data_dir argument of the download function which wasn't used, by passing the argument to the appropriate function.

KamalakerDadi commented 3 years ago

Thanks.

I didn't have to fix the scikit-learn version in the requirements.

But, import error may still appear for < 0.22.0? There may be users who have version < 0.22.0

RaphaelMeudec commented 3 years ago

@KamalakerDadi I didn't have to touch the requirements because the Bunch import that was failing post-0.22 was due to sklearn.datasets.base being hidden after 0.22. But sklearn.utils.Bunch exists pre-0.22 and after-0.22, so replacing the import fixes it whatever the version is.

KamalakerDadi commented 3 years ago

Great Thanks @RaphaelMeudec

bthirion commented 3 years ago

Merging now, thx.