sklearn-crfsuite
sklearn-crfsuite copied to clipboard
Fix sklearn FutureWarning for params not available for cloning.
using CRF within a sklearn Pipeline, raises a FutureWarning with sklearn 0.23. This will raise an AttributeError from version 0.24.
Repro for the warning.
from sklearn.pipeline import Pipeline
from sklearn_crfsuite import CRF
from sklearn.preprocessing import StandardScaler
Pipeline([('scaler', StandardScaler()), ('crf', CRF())]).get_params()
/Users/tom/anaconda3/envs/cattrainer/lib/python3.7/site-packages/sklearn/base.py:213: FutureWarning: From version 0.24, get_params will raise an AttributeError if a parameter cannot be retrieved as an instance attribute. Previously it would return None.
FutureWarning)
Tested in jupyter with this change via pip install -e sklearn-crfsuite/. and the proposed change. tox passes.
Codecov Report
Merging #57 into master will increase coverage by
0.05%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #57 +/- ##
==========================================
+ Coverage 92.60% 92.66% +0.05%
==========================================
Files 8 8
Lines 257 259 +2
Branches 37 37
==========================================
+ Hits 238 240 +2
Misses 15 15
Partials 4 4
Impacted Files | Coverage Δ | |
---|---|---|
sklearn_crfsuite/estimator.py | 95.52% <100.00%> (+0.06%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 293a2d0...8838d8a. Read the comment docs.