Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sklearn FutureWarning for params not available for cloning. #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tomolopolis
Copy link

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-commenter
Copy link

codecov-commenter commented Aug 18, 2020

Codecov Report

Merging #57 into master will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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%) ⬆️

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants