Open ftnext opened 3 years ago
The workaround described here does not work for me with Python 3.10.
I have tried asking pip to install sklearn<0.24, and even if I specify --prefer-binaries
, it will still attempt to build sklearn from source, then fail when trying to build a dependency (numpy) from source.
I'm guessing that the (probably old) version of numpy required for sklearn<0.24 is not compatible with python 3.10 for whatever reason.
edit: reference on old numpy not working with Python 3.10 https://github.com/numpy/numpy/issues/19033
I also get the same error when using some of sklearn's model selection features, specifically sklearn.model_selection.RandomizedSearchCV
and sklearn.model_selection.GridSearchCV
How to fix?
Look at the pull request I opened: #69
ta
hello, how can I get the training loss?
I have a workaround, Go to the sklearn_crfsuite
repository in your local machine (It will be in python3.*/site-packages/sklearn_crfsuite
and in the estimator.py
file, comment out lines:
238 - model_filename=None
239 - keep_tempfiles=False
268 - filename=model_filesname
269 - keep_tempfiles=keep_tempfiles
This worked on scikit-learn = "^1.2.0"
Edit: Even better, Simply install this updated repo https://github.com/MeMartijn/updated-sklearn-crfsuite
instead of sklearn-crfsuite which has the fix. Installation instructions - https://github.com/TeamHG-Memex/sklearn-crfsuite/pull/67#issuecomment-1167519941
I face this problem with
scikit_learn-1.2.2
tried to
pip install -U 'scikit-learn<0.24'
but it doesn't work with python3.10
Does anyone have a workaround?
I have submitted the following PR to fix this: https://github.com/TeamHG-Memex/sklearn-crfsuite/pull/74
I have submitted the following PR to fix this: #74
Unfortunately, This repo is no longer maintained and not accepting pull requests. Their last commits were many years old.
For the record, 0.4.0 is out addressing this issue. Maintenance of the package will continue at https://github.com/scrapinghub/sklearn-crfsuite.
Environment
macOS Python 3.8.6
Procedure
The tutorial code: https://sklearn-crfsuite.readthedocs.io/en/latest/tutorial.html#training
As is
Raises AttributeError
Expected
No error
Workaround
Use scikit-learn under 0.24
In my case, scikit-learn 0.23.2 installed.
Related Information
repr(crf)
shows the following warning in scikit-learn<0.24:Change log in scikit-learn 0.24
https://scikit-learn.org/dev/whats_new/v0.24.html#sklearn-base
The CRF class seems to inherit
sklearn.base.BaseEstimator
(when it can be imported) and the values returned by the classmethod_get_param_names()
includes the attributes likekeep_tempfiles
, which are not defined in CRF class (code).