scikit-learn-contrib / lightning

Large-scale linear classification, regression and ranking in Python
https://contrib.scikit-learn.org/lightning/
1.73k stars 214 forks source link

[HOTFIX] fix compatibility with new scikit-learn version #142

Closed StrikerRUS closed 4 years ago

StrikerRUS commented 4 years ago

This PR will allow using lightning with the latest version (0.23.0) of scikit-learn. Right now if you try to upgrade scikit-learn, lightning fails with the error about that it cannot import neither joblib nor six because they are no longer exist in sklearn.externals:

    from lightning.classification import KernelSVC
../../../virtualenv/python3.6.7/lib/python3.6/site-packages/lightning/classification.py:1: in <module>
    from .impl.adagrad import AdaGradClassifier
../../../virtualenv/python3.6.7/lib/python3.6/site-packages/lightning/impl/adagrad.py:8: in <module>
    from sklearn.externals.six.moves import xrange

six was dropped along with Python 2 support. https://scikit-learn.org/stable/whats_new/v0.21.html#sklearn-externals

joblib is now a dependency: https://scikit-learn.org/stable/whats_new/v0.21.html#miscellaneous

This PR should be treated as a hotfix, and ideally lightning should drop the support of Python 2 with six dependency.

StrikerRUS commented 4 years ago

I don't think that hinge_multiclass failures are caused by changes from this PR.

StrikerRUS commented 4 years ago

Hello @mblondel @MechCoder @zermelozf @fabianp !

Can you please clarify the status of this great project? Is it abandoned?

This project is no longer compatible with scikit-learn and requires some hotfixes (presented in this PR).

mblondel commented 4 years ago

Merging. Thanks a lot and sorry for the delay!

The project is indeed no longer actively maintained but hot fixes like this to follow the latest scikit-learn are very welcome.

StrikerRUS commented 4 years ago

@mblondel Thank you very much for your response and for merging this PR! I'm happy to help.

BTW, it will be cool to release a new version of the project at PyPI. The latest release was in 2017 and I believe there are some critical hotfixes (#142 and #134) in the master branch that could be a great candidates for a new release.

StrikerRUS commented 4 years ago

@mblondel Hello! Is it possible to release a fresh version of this project on PyPI?

aldanor commented 3 years ago

@mblondel Could this be released to PyPI?

mblondel commented 3 years ago

@fabianp Do you think you could take care of this?

Personally, I don't have the bandwidth to do it. If nobody can do it, I suggest we remove lightning from pip and switch to a pip install git+git://github.com/... scheme instead.

fabianp commented 3 years ago

done: https://pypi.org/project/sklearn-contrib-lightning/

mblondel commented 3 years ago

Thanks so much! 🎉