vzhou842 / profanity-check

A fast, robust Python library to check for offensive language in strings.

Home Page:https://pypi.org/project/profanity-check

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposal: Remove scikit-learn as a dependency

iMerica opened this issue · comments

Hi,

Thank you for working on this project!

As far as I can tell, scikit-learn–– which is a massive dependency, is not exactly required to make this package work. Maybe it's required for training a model, but it should not be required for using the model (which is what this package is for).

You're using joblib, which is a transitive dependency on Skikit anyway. Even they suggest removing it:

sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.

@iMerica that's a great point. Do you want to submit a PR for this? Should be pretty straightforward

To assist this is the full messages we get for Python 3.8:

/home/dimitry/.virtualenvs/app_yourself_online_3_dot_8/lib/python3.8/site-packages/sklearn/externals/joblib/__init__.py:15: FutureWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.
  warnings.warn(msg, category=FutureWarning)
/home/dimitry/.virtualenvs/app_yourself_online_3_dot_8/lib/python3.8/site-packages/sklearn/base.py:313: UserWarning: Trying to unpickle estimator CountVectorizer from version 0.20.2 when using version 0.22.2.post1. This might lead to breaking code or invalid results. Use at your own risk.
  warnings.warn(
/home/dimitry/.virtualenvs/app_yourself_online_3_dot_8/lib/python3.8/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.svm.classes module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.svm. Anything that cannot be imported from sklearn.svm is now part of the private API.
  warnings.warn(message, FutureWarning)
/home/dimitry/.virtualenvs/app_yourself_online_3_dot_8/lib/python3.8/site-packages/sklearn/base.py:313: UserWarning: Trying to unpickle estimator LinearSVC from version 0.20.2 when using version 0.22.2.post1. This might lead to breaking code or invalid results. Use at your own risk.
  warnings.warn(
/home/dimitry/.virtualenvs/app_yourself_online_3_dot_8/lib/python3.8/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.preprocessing.label module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.preprocessing. Anything that cannot be imported from sklearn.preprocessing is now part of the private API.
  warnings.warn(message, FutureWarning)
/home/dimitry/.virtualenvs/app_yourself_online_3_dot_8/lib/python3.8/site-packages/sklearn/base.py:313: UserWarning: Trying to unpickle estimator LabelEncoder from version 0.20.2 when using version 0.22.2.post1. This might lead to breaking code or invalid results. Use at your own risk.
  warnings.warn(
/home/dimitry/.virtualenvs/app_yourself_online_3_dot_8/lib/python3.8/site-packages/sklearn/base.py:313: UserWarning: Trying to unpickle estimator _SigmoidCalibration from version 0.20.2 when using version 0.22.2.post1. This might lead to breaking code or invalid results. Use at your own risk.
  warnings.warn(
/home/dimitry/.virtualenvs/app_yourself_online_3_dot_8/lib/python3.8/site-packages/sklearn/base.py:313: UserWarning: Trying to unpickle estimator CalibratedClassifierCV from version 0.20.2 when using version 0.22.2.post1. This might lead to breaking code or invalid results. Use at your own risk.
  warnings.warn(

As of now joblib is not in sklearn externals which makes the link above broken: https://github.com/scikit-learn/scikit-learn/tree/master/sklearn/externals

Did not check on why but this is the same as #12 with tests passing.

closed by #13