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 two warnings from sklearn #327

Merged
merged 2 commits into from
Sep 27, 2020
Merged

fix two warnings from sklearn #327

merged 2 commits into from
Sep 27, 2020

Conversation

StrikerRUS
Copy link
Member

tests/test_rgf_python.py::TestRGFClassifier::test_sklearn_integration
tests/test_rgf_python.py::TestRGFRegressor::test_sklearn_integration
  /home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/sklearn/utils/estimator_checks.py:488: FutureWarning: Passing a class is deprecated since version 0.23 and won't be supported in 0.24.Please pass an instance instead.
    warnings.warn(msg, FutureWarning)
tests/test_rgf_python.py::TestRGFClassifier::test_sklearn_integration
tests/test_rgf_python.py::TestRGFRegressor::test_sklearn_integration
  /home/travis/miniconda/envs/test-environment/lib/python3.6/site-packages/sklearn/utils/estimator_checks.py:3014: FutureWarning: As of scikit-learn 0.23, estimators should expose a n_features_in_ attribute, unless the 'no_validation' tag is True. This attribute should be equal to the number of features passed to the fit method. An error will be raised from version 0.25 when calling check_estimator(). See SLEP010: https://scikit-learn-enhancement-proposals.readthedocs.io/en/latest/slep010/proposal.html
    FutureWarning

@StrikerRUS StrikerRUS requested a review from fukatani September 21, 2020 13:37
@StrikerRUS StrikerRUS changed the title fix two warnings from skelarn fix two warnings from sklearn Sep 21, 2020
@@ -559,6 +559,7 @@ def fit(self, X, y, sample_weight=None):
raise ValueError("Classifier can't predict when only one class is present.")

self._fitted = True
self.n_features_in_ = self._n_features
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not property: because now scikit-learn is checking only attributes with trailing underscore, not properties microsoft/LightGBM#3014 (comment)

Copy link
Member

@fukatani fukatani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for your contribution!

@fukatani fukatani merged commit faf4b4a into master Sep 27, 2020
@StrikerRUS StrikerRUS deleted the sklearn branch September 27, 2020 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants