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

Corrected the missing zero_division argument #15879

merged 6 commits into from Dec 21, 2019


Copy link

Bibyutatsu commented Dec 13, 2019

Reference Issues/PRs

Issue #15878

What does this implement/fix? Explain your changes.

This implement fixes the Macro average error which was being caused due to the missing zero_division argument here.

Any other comments?

It is just one line of code containing the argument so there won't be any issue if it is merged to the master branch directly so that we can quickly update the module and get the correct output.

Copy link

NicolasHug left a comment

Thanks for the PR,

Can you please add a non-regression test (mentioning the original issue number) by e.g. making sure the warning isn't raised when zero_division != warn? The test should be failing on master

Copy link

qinhanmin2014 left a comment

thanks, please add a test

@qinhanmin2014 qinhanmin2014 added this to the 0.22.1 milestone Dec 14, 2019
ogrisel added 3 commits Dec 20, 2019

This comment has been minimized.

Copy link

ogrisel commented Dec 20, 2019

@Bibyutatsu I pushed a few commits to add the missing test for this PR to be able to get it merged in time for the 0.22.1 release.

Note that you issued your PR from your master branch. Next time I would rather advise to create a new branch each time your want to issue a new PR instead. This way you can track the ever evolving state of the upstream master branch in your own master branch, irrespective of the order of the merge of your future contributions.


This comment has been minimized.

Copy link

ogrisel commented Dec 20, 2019

@NicolasHug @qinhanmin2014 I just added a minimal test that check the presence or abscence of the warning based on the value of the zero_division variable. The actual values of the metrics are already properly tested in other tests for the underlying metric functions.

@ogrisel ogrisel requested review from NicolasHug and qinhanmin2014 Dec 20, 2019

This comment has been minimized.

Copy link

ogrisel commented Dec 21, 2019

@glemaitre if you are still around ;)

@glemaitre glemaitre self-requested a review Dec 21, 2019
@glemaitre glemaitre merged commit dfad061 into scikit-learn:master Dec 21, 2019
15 of 17 checks passed
15 of 17 checks passed
ci/circleci: doc CircleCI is running your tests
ci/circleci: doc-min-dependencies CircleCI is running your tests
LGTM analysis: C/C++ No code changes detected
LGTM analysis: JavaScript No code changes detected
LGTM analysis: Python No new or fixed alerts
ci/circleci: lint Your tests passed on CircleCI!
scikit-learn.scikit-learn Build #20191221.9 succeeded
scikit-learn.scikit-learn (Linting) Linting succeeded
scikit-learn.scikit-learn (Linux py35_conda_openblas) Linux py35_conda_openblas succeeded
scikit-learn.scikit-learn (Linux py35_ubuntu_atlas) Linux py35_ubuntu_atlas succeeded
scikit-learn.scikit-learn (Linux pylatest_pip_openblas_pandas) Linux pylatest_pip_openblas_pandas succeeded
scikit-learn.scikit-learn (Linux32 py35_ubuntu_atlas_32bit) Linux32 py35_ubuntu_atlas_32bit succeeded
scikit-learn.scikit-learn (Linux_Runs pylatest_conda_mkl) Linux_Runs pylatest_conda_mkl succeeded
scikit-learn.scikit-learn (Windows py35_pip_openblas_32bit) Windows py35_pip_openblas_32bit succeeded
scikit-learn.scikit-learn (Windows py37_conda_mkl) Windows py37_conda_mkl succeeded
scikit-learn.scikit-learn (macOS pylatest_conda_mkl) macOS pylatest_conda_mkl succeeded
scikit-learn.scikit-learn (macOS pylatest_conda_mkl_no_openmp) macOS pylatest_conda_mkl_no_openmp succeeded
ogrisel added a commit to ogrisel/scikit-learn that referenced this pull request Dec 31, 2019
ogrisel added a commit to ogrisel/scikit-learn that referenced this pull request Jan 2, 2020
ogrisel added a commit that referenced this pull request Jan 2, 2020
* DOC fixed default values in dbscan (#15753)

* DOC fix incorrect branch reference in contributing doc (#15779)

* DOC relabel Feature -> Efficiency in change log (#15770)

* DOC fixed Birch default value (#15780)

* STY Minior change on code padding in website theme (#15768)

* DOC Fix yticklabels order in permutation importances example (#15799)

* Fix yticklabels order in permutation importances example

* STY Update wrapper width (#15793)

* DOC Long sentence was hard to parse and ambiguous in (#15769)

* DOC Removed duplicate 'classes_' attribute in Naive Bayes classifiers (#15811)

* BUG Fixes pandas dataframe bug with boolean dtypes (#15797)

* BUG Returns only public estimators in all_estimators (#15380)

* DOC improve doc for multiclass and types_of_target (#15333)

* TST Increases tol for check_pca_float_dtype_preservation assertion (#15775)

* update _alpha_grid class in (#15835)

* FIX Explicit conversion of ndarray to object dtype. (#15832)

* BLD Parallelize sphinx builds on circle ci (#15745)

* DOC correct url for preprocessing (#15853)

* MNT avoid generating too many cross links in examples (#15844)

* DOC Correct wrong doc in precision_recall_fscore_support (#15833)

* DOC add comment in check_pca_float_dtype_preservation (#15819)

Documenting the changes in #15775

* DOC correct indents in docstring (#15843)

* DOC fix docstring of KMeans based on sklearn guideline (#15754)

* DOC fix docstring of AgglomerativeClustering based on sklearn guideline (#15764)

* DOC fix docstring of AffinityPropagation based on sklearn guideline (#15777)

* DOC fixed SpectralCoclustering and SpectralBiclustering docstrings following sklearn guideline (#15778)

* DOC fix FeatureAgglomeration and MiniBatchKMeans docstring following sklearn guideline (#15809)

* TST Specify random_state in test_cv_iterable_wrapper (#15829)

* DOC Include LinearSV{C, R} in models that support sample_weights (#15871)

* DOC correct some indents (#15875)

* DOC Fix documentation of default values in tree classes (#15870)

* DOC fix typo in docstring (#15887)

* DOC FIX default value for xticks_rotation in plot_confusion_matrix (#15890)

* Fix imports in pip3 ubuntu by suffixing affected files (#15891)

* MNT Raise erorr when normalize is invalid in confusion_matrix (#15888)

* [MRG] DOC Increases search results for API object results (#15574)

* MNT Ignores warning in pyamg for deprecated scipy.random (#15914)

* DOC Instructions to troubleshoot Windows path length limit (#15916)

* DOC add versionadded directive to some estimators (#15849)

* DOC clarify doc-string of roc_auc_score and add references (#15293)

* MNT Adds skip lint to azure pipeline CI (#15904)

* BLD Fixes bug when building with NO_MATHJAX=1 (#15892)

* [MRG] BUG Checks to number of axes in passed in ax more generically (#15760)

* EXA Minor fixes in (#15925)

* BUG Do not shadow public functions with deprecated modules (#15846)

* Import sklearn._distributor_init first (#15929)

* DOC Fix typos, via a Levenshtein-style corrector (#15923)

* DOC in canned comment, mention that PR title becomes commit me… (#15935)

* DOC/EXA Correct spelling of "Classification" (#15938)

* BUG fix pip3 ubuntu update by suffixing file (#15928)

* [MRG] Ways to compute center_shift_total were different in "full" and "elkan" algorithms. (#15930)

* TST Fixes integer test for train and test indices (#15941)

* BUG ensure that parallel/sequential give the same permutation importances (#15933)

* Formatting fixes in changelog (#15944)

* MRG FIX: order of values of self.quantiles_ in QuantileTransformer (#15751)

* [MRG] BUG Fixes constrast in plot_confusion_matrix (#15936)

* BUG use zero_division argument in classification_report (#15879)

* DOC change logreg solver in plot_logistic_path (#15927)

* DOC fix whats new ordering (#15961)

* COSMIT use np.iinfo to define the max int32 (#15960)

* DOC Apply numpydoc validation to VotingRegressor methods (#15969)

Co-authored-by: Tiffany R. Williams <>

* DOC improve documentation (#15943)

Co-authored-by: Jigna Panchal <>

* DOC Fix default values in Perceptron documentation (#15965)

* DOC Improve default values in logistic documentation (#15966)

Co-authored-by: Guillaume Lemaitre <>

* DOC Improve documentation of default values for imputers (#15964)

* EXA/MAINT Simplify code in manifold learning example (#15949)

* DOC Improve default values in SGD documentation (#15967)

* DOC Improve defaults in neural network documentation (#15968)

* FIX use safe_sparse_dot for callable kernel in LabelSpreading (#15868)

* BUG Adds attributes back to check_is_fitted (#15947)

Co-authored-by: Olivier Grisel <>

* DOC update check_is_fitted what's new

* DOC change python-devel to python3-devel for yum. (#15986)

* DOC Correct the default value of values_format in plot_confusion_matrix (#15981)

* [MRG] MNT Updates pypy to use 7.2.0 (#15954)

* FIX Add missing 'values_format' param to disp.plot() in plot_confusion_matrix (#15937)

* FIX support scalar values in fit_params in SearchCV (#15863)

* support a scalar fit param

* pep8

* TST add test for desired behavior

* FIX introduce _check_fit_params to validate parameters

* DOC update whats new

* TST tests both grid-search and randomize-search

* PEP8

* DOC revert unecessary change

* TST add test for _check_fit_params

* olivier comments

* TST fixes

* DOC whats new

* DOC whats new

* TST revert type of error

* add olivier suggestions

* address olivier comments

* address thomas comments

* PEP8

* comments olivier

* TST fix test by passing X

* avoid to call twice tocsr

* add case column/row sparse in check_fit_param

* provide optional indices

* TST check content when indexing params

* PEP8

* TST update tests to check identity

* stupid fix

* use a distribution in RandomizedSearchCV

* MNT add lightgbm to one of the CI build

* move to another build

* do not install dependencies lightgbm

* MNT comments on the CI setup

* address some comments

* Test fit_params compat without dependency on lightgbm

Co-authored-by: Guillaume Lemaitre <>
Co-authored-by: Olivier Grisel <>

* Remove abstractmethod that silently brake downstream packages (#15996)

* FIX restore BaseNB._check_X without abstractmethod decoration (#15997)

* Update v0.22 changelog for 0.22.1 (#16002)

- set the date
- move entry for quantile transformer to the 0.22.1 section
- fix alphabetical ordering of modules

* STY Removes hidden scroll bar (#15999)

* Flake8 fixes

* Fix: remove left-over lines that should have been deleted during conflict resolution when rebasing

* Fix missing imports

* Update version

* Fix test_check_is_fitted

* Make test_sag_regressor_computed_correctly deterministic (#16003)

Fix #15818.

Co-authored-by: cgsavard <>
Co-authored-by: Joel Nothman <>
Co-authored-by: Thomas J Fan <>
Co-authored-by: Matt Hall <>
Co-authored-by: Kathryn Poole <>
Co-authored-by: lucyleeow <>
Co-authored-by: JJmistry <>
Co-authored-by: Juan Carlos Alfaro Jiménez <>
Co-authored-by: SylvainLan <>
Co-authored-by: Nicolas Hug <>
Co-authored-by: Hanmin Qin <>
Co-authored-by: Adrin Jalali <>
Co-authored-by: Vachan D A <>
Co-authored-by: Sambhav Kothari <>
Co-authored-by: wenliwyan <>
Co-authored-by: shivamgargsya <>
Co-authored-by: Reshama Shaikh <>
Co-authored-by: Oliver Urs Lenz <>
Co-authored-by: Loïc Estève <>
Co-authored-by: Brian Wignall <>
Co-authored-by: Ritchie Ng <>
Co-authored-by: Guillaume Lemaitre <>
Co-authored-by: inderjeet <>
Co-authored-by: scibol <>
Co-authored-by: Tirth Patel <>
Co-authored-by: Bibhash Chandra Mitra <>
Co-authored-by: Alexandre Gramfort <>
Co-authored-by: Tiffany R. Williams <>
Co-authored-by: Jigna Panchal <>
Co-authored-by: @nkish <>
Co-authored-by: Pulkit Mehta <>
Co-authored-by: David Breuer <>
Co-authored-by: Niklas <>
Co-authored-by: Windber <>
Co-authored-by: Stephen Blystone <>
Co-authored-by: Brigitta Sipőcz <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
5 participants
You can’t perform that action at this time.