Commit Graph

67 Commits

Author SHA1 Message Date
Adrin Jalali 69c8967e21 DOC Fix warnings in examples (#12654)
Fixe or suppresses many warnings in examples, including matplotlib complaining about the non-gui backend.
2019-01-17 21:41:13 +11:00
Wenhao Zhang 581752012c ENH refit=callable in *SearchCV adds flexibility in identifying the best estimator (#11354) 2019-01-09 12:56:30 +11:00
Hanmin Qin 9acc606e60 EXA Use cv=5 instead of cv=10 in plot_validation_curve.py (#12929) 2019-01-07 15:21:42 +01:00
Mickaël Schoentgen 2df594564d EXA Fix several DeprecationWarning: invalid escape sequence in examples (#12924) 2019-01-05 12:22:36 +08:00
Adrin Jalali 2bd87f6ed8 Remove python < 3.5 from CI (#12746) 2018-12-14 10:53:12 +01:00
Quentin Batista 4b78d7abf4 DOC: Clarify `cv` parameter description in `GridSearchCV` (#12495)
#### Reference Issues/PRs
<!--
Example: Fixes #1234. See also #3456.
Please use keywords (e.g., Fixes) to create link to the issues or pull requests
you resolved, so that they will automatically be closed when your pull request
is merged. See https://github.com/blog/1506-closing-issues-via-pull-requests
-->

This PR addresses issue #12466.

#### What does this implement/fix? Explain your changes.

This PR does the 3 following things:
- Rewrite the `cv` parameter description in `GridSearchCV`
- Link the new `CV splitter` description to an existing example
- Add an example with a custom iterable

Thanks for reviewing this!

Close #12466
2018-11-12 15:10:15 -05:00
Hanmin Qin dd3b705f7b MNT Unused imports in examples 2018-10-02 17:12:19 +08:00
Joel Nothman 2fe58e517c Deprecate min_samples_leaf and min_weight_fraction_leaf (#11870) 2018-08-23 08:30:47 +03:00
Hanmin Qin 8890b50606 [MRG+1] EXA Set cv=5 in examples (#11856)
* EXA Set cv=5 in examples

* small mistake

* [doc build]

* [doc build]

* cross_val*

* [doc build]

* [doc build]
2018-08-20 15:22:42 -04:00
Hanmin Qin 9b8fd0b0d0 DOC Correct default n_jobs & reference the glossary (#11808)
Also improves the glossary entry for n_jobs.
2018-08-18 19:57:10 +10:00
Hanmin Qin d8a0f5a06c DOC best_parameters_ -> best_params_ 2018-08-16 10:03:37 +08:00
Chris Holdgraf 1641f31cfa EXA Adding cv indices example (#11475) 2018-07-31 08:41:12 +08:00
Andreas Mueller 0b8d362545 [MRG] Examples deprecations (#11561) 2018-07-17 00:08:04 -05:00
Andreas Mueller eec7649236 MAINT Complete 0.20 deprecations (#9570) 2018-06-24 23:06:26 +10:00
Ming Li 325a7f9e6c EXA prevent example xlabel cut off in plot_confusion_matrix.py (#11065) 2018-05-04 22:47:23 +08:00
Roman Yurchak d9a0774afc MAINT Always import signature from sklearn.utils.fixes (#11019) 2018-04-24 09:27:45 +10:00
Félix Raimundo 19e2772cac DOC Wording in crossval example (#10820)
Replace "Luck" by "Chance" on the crossvalidation example as it
sounds better in English.
2018-03-18 09:30:11 +11:00
Joel Nothman 6b5440a996 DOC move plot_cv_predict example into model_selection (#10722) 2018-02-28 19:54:43 +08:00
Saurabh Gupta 1776a19be6 DOC: add description for 'train_sizes' in examples.model_selection.plot_learning_curve (#10702) 2018-02-27 09:00:38 +11:00
Loïc Estève db127bd969 [MRG+1] Support minimal dependencies in examples (#10351)
* Support minimal dependencies in examples
* bins="auto" only supported for numpy >= 1.11
* viridis is default cmap in matplotlib 2
* Use signature instead of viridis cmap
2018-01-08 21:36:28 +01:00
Hanmin Qin 5963fd2150
DOC Fix broken link in ROC example (#10151) 2017-11-16 14:25:28 +08:00
syonekura 32fcc364ab [MRG+1] Setting max_iter/tol explicitly for SGD estimators in docs (#9776) 2017-10-04 17:28:32 +02:00
Anthony Gitter 59bb32ff71 DOC Add average precision definitions and cross references (#9583) 2017-09-25 20:04:21 +10:00
Tom Dupré la Tour e55d0bcba5 FIX broken link in gallery and bad title rendering 2017-07-12 16:37:49 +02:00
(Venkat) Raghav, Rajagopalan a08555a238 [MRG + 2] ENH Allow `cross_val_score`, `GridSearchCV` et al. to evaluate on multiple metrics (#7388)
* ENH cross_val_score now supports multiple metrics

* DOCFIX permutation_test_score

* ENH validate multiple metric scorers

* ENH Move validation of multimetric scoring param out

* ENH GridSearchCV and RandomizedSearchCV now support multiple metrics

* EXA Add an example demonstrating the multiple metric in GridSearchCV

* ENH Let check_multimetric_scoring tell if its multimetric or not

* FIX For single metric name of scorer should remain 'score'

* ENH validation_curve and learning_curve now support multiple metrics

* MNT move _aggregate_score_dicts helper into _validation.py

* TST More testing/ Fixing scores to the correct values

* EXA Add cross_val_score to multimetric example

* Rename to multiple_metric_evaluation.py

* MNT Remove scaffolding

* FIX doctest imports

* FIX wrap the scorer and unwrap the score when using _score() in rfe

* TST Cleanup the tests. Test for is_multimetric too

* TST Make sure it registers as single metric when scoring is of that type

* PEP8

* Don't use dict comprehension to make it work in python2.6

* ENH/FIX/TST grid_scores_ should not be available for multimetric evaluation

* FIX+TST delegated methods NA when multimetric is enabled...

TST Add general tests to GridSearchCV and RandomizedSearchCV

* ENH add option to disable delegation on multimetric scoring

* Remove old function from __all__

* flake8

* FIX revert disable_on_multimetric

* stash

* Fix incorrect rebase

* [ci skip]

* Make sure refit works as expected and remove irrelevant tests

* Allow passing standard scorers by name in multimetric scorers

* Fix example

* flake8

* Address reviews

* Fix indentation

* Ensure {'acc': 'accuracy'} and ['precision'] are valid inputs

* Test that for single metric, 'score' is a key

* Typos

* Fix incorrect rebase

* Compare multimetric grid search with multiple single metric searches

* Test X, y list and pandas input; Test multimetric for unsupervised grid search

* Fix tests; Unsupervised multimetric gs will not pass until #8117 is merged

* Make a plot of Precision vs ROC AUC for RandomForest varying the n_estimators

* Add example to grid_search.rst

* Use the classic tuning of C param in SVM instead of estimators in RF

* FIX Remove scoring arg in deafult scorer test

* flake8

* Search for min_samples_split in DTC; Also show f-score

* REVIEW Make check_multimetric_scoring private

* FIX Add more samples to see if 3% mismatch on 32 bit systems gets fixed

* REVIEW Plot best score; Shorten legends

* REVIEW/COSMIT multimetric --> multi-metric

* REVIEW Mark the best scores of P/R scores too

* Revert "FIX Add more samples to see if 3% mismatch on 32 bit systems gets fixed"

This reverts commit ba766d98353380a186fbc3dade211670ee72726d.

* ENH Use looping for iid testing

* FIX use param grid as scipy's stats dist in 0.12 do not accept seed

* ENH more looping less code; Use small non-noisy dataset

* FIX Use named arg after expanded args

* TST More testing of the refit parameter

* Test that in multimetric search refit to single metric, the delegated methods
  work as expected.
* Test that setting probability=False works with multimetric too
* Test refit=False gives sensible error

* COSMIT multimetric --> multi-metric

* REV Correct example doc

* COSMIT

* REVIEW Make tests stronger; Fix bugs in _check_multimetric_scorer

* REVIEW refit param: Raise for empty strings

* TST Invalid refit params

* REVIEW Use <scorer_name> alone; recall --> Recall

* REV specify when we expect scorers to not be None

* FLAKE8

* REVERT multimetrics in learning_curve and validation_curve

* REVIEW Simpler coding style

* COSMIT

* COSMIT

* REV Compress example a bit. Move comment to top

* FIX fit_grid_point's previous API must be preserved

* Flake8

* TST Use loop; Compare with single-metric

* REVIEW Use dict-comprehension instead of helper

* REVIEW Remove redundant test

* Fix tests incorrect braces

* COSMIT

* REVIEW Use regexp

* REV Simplify aggregation of score dicts

* FIX precision and accuracy test

* FIX doctest and flake8

* TST the best_* attributes multimetric with single metric

* Address @jnothman's review

* Address more comments \o/

* DOCFIXES

* Fix use the validated fit_param from fit's arguments

* Revert alpha to a lower value as before

* Using def instead of lambda

* Address @jnothman's review batch 1: Fix tests / Doc fixes

* Remove superfluous tests

* Remove more superfluous testing

* TST/FIX loop over refit and check found n_clusters

* Cosmetic touches

* Use zip instead of manually listing the keys

* Fix inverse_transform

* FIX bug in fit_grid_point; Allow only single score

TST if fit_grid_point works as intended

* ENH Use only ROC-AUC and F1-score

* Fix typos and flake8; Address Andy's reviews

MNT Add a comment on why we do such a transpose + some fixes

* ENH Better error messages for incorrect multimetric scoring values +...

ENH Avoid exception traceback while using incorrect scoring string

* Dict keys must be of string type only

* 1. Better error message for invalid scoring 2...
Internal functions return single score for single metric scoring

* Fix test failures and shuffle tests

* Avoid wrapping scorer as dict in learning_curve

* Remove doc example as asked for

* Some leftover ones

* Don't wrap scorer in validation_curve either

* Add a doc example and skip it as dict order fails doctest

* Import zip from six for python2.7 compat

* Make cross_val_score return a cv_results-like dict

* Add relevant sections to userguide

* Flake8 fixes

* Add whatsnew and fix broken links

* Use AUC and accuracy instead of f1

* Fix failing doctests cross_validation.rst

* DOC add the wrapper example for metrics that return multiple return values

* Address andy's comments

* Be less weird

* Address more of andy's comments

* Make a separate cross_validate function to return dict and a cross_val_score

* Update the docs to reflect the new cross_validate function

* Add cross_validate to toc-tree

* Add more tests on type of cross_validate return and time limits

* FIX failing doctests

* FIX ensure keys are not plural

* DOC fix

* Address some pending comments

* Remove the comment as it is irrelevant now

* Remove excess blank line

* Fix flake8 inconsistencies

* Allow fit_times to be 0 to conform with windows precision

* DOC specify how refit param is to be set in multiple metric case

* TST ensure cross_validate works for string single metrics + address @jnothman's reviews

* Doc fixes

* Remove the shape and transform parameter of _aggregate_score_dicts

* Address Joel's doc comments

* Fix broken doctest

* Fix the spurious file

* Address Andy's comments

* MNT Remove erroneous entry

* Address Andy's comments

* FIX broken links

* Update whats_new.rst

missing newline
2017-07-07 11:12:31 -04:00
plagree 1f6ac72df7 [MRG] DOC examples with correct notebook style (#9061)
* DOC examples with correct notebook style

* Modifications in examples/ to avoid unwanted notebook style

* Remove last notebook style example

* Space formatting to avoid notebook style
2017-06-20 14:48:57 +02:00
Gael Varoquaux 494a240862 DOC: Simpler precision-recall example, remove 11pt
Remove the eleven average precision score

Add better tests.
2017-06-10 00:56:16 +02:00
Aarshay Jain 6986e9b5db [MRG + 1] 18 more examples with matplotlib 2.0 updates (#8983)
* updated plot_label_propagation_versus_svm_iris.py plot

* updated svm/plot_weighted_samples.py plot

* made semi_supervised/plot_label_propagation_versus_svm_iris.py pep8 compliant

* modified tree/plot_tree_regression.py [size and edgecolor]

* updated tree/plot_tree_regression_multioutput.py [size+color]

* fixed examples/semi_supervised/plot_label_propagation_versus_svm_iris.py for backward compatibility

* neural_networks/plot_mlp_alpha.py - matplotlib2 update

* examples/neural_networks/plot_mlp_alpha.py - pep8 fix

* examples/neighbors/plot_nearest_centroid.py - matplotlib2.0 + pep8 fix

* neighbors/plot_classification.py - matplotlib2.0 + pep8 fix

* examples/neighbors/plot_lof.py - matplotlib2.0 update

* examples/model_selection/plot_underfitting_overfitting.py - matplotlib2.0 + pep8

* examples/mixture/plot_concentration_prior.py - matplotlib2.0 + pep8

* examples/linear_model/plot_logistic_multinomial.py - matplotlib2.0 update

* linear_model/plot_sgd_iris.py - matplotlib2.0 + pep8 fix

* examples/linear_model/plot_sgd_weighted_samples.py - matplotlib2.0 + pep8

* examples/linear_model/plot_sgd_separating_hyperplane.py - matplotlib2.0 update

* examples/feature_selection/plot_permutation_test_for_classification.py - matplotlib + pe8

* examples/linear_model/plot_bayesian_ridge.py - matplotlib2.0 update

* examples/feature_selection/plot_feature_selection.py - matplotlib2.0 update

* examples/feature_selection/plot_f_test_vs_mi.py - matplotlib2.0 + pep8

* examples/feature_selection/plot_f_test_vs_mi.py - matplotlib2.0+ pep8 fix

* examples/model_selection/plot_underfitting_overfitting.py - error fixed

* blue -> black edgecolor fix for 2 examples
2017-06-07 13:23:12 +02:00
Loïc Estève 719afba518 [MRG] Run more examples as part of the doc generation (#8851)
Also fix errors and flake8 violations of existing examples
2017-05-11 23:42:57 +02:00
Manraj Singh 6d604d1d93 [MRG] Randomized Search Example: Fix min_samples_split values for RandomizedSearchCV and GridSearchCV (#8847)
* Randomized Search Example: Fix min_samples_split values for RandomizedSearchCV and GridSearchCV

* Randomized Search Example: Change min_samples_split from 1.0 -> 2
2017-05-10 07:51:56 +10:00
Puneet Mathur 9e0e2d41fe [MRG+1] Spelling mistake in Feature Extraction documentation (#8763)
* task: Fixed the minor change in code from svr to svm merging back to main branch http://scikit-learn.org/dev/modules/generated/sklearn.model_selection.GridSearchCV.html#sklearn.model_selection.GridSearchCV done on: Mar 13 2017 14:30 IST

* issue#8761: Fixed the code with spelling mistake Spelling mistake in
Feature Extraction documentation #8761
2017-04-19 10:20:22 -07:00
NALEPA Emmanuel 53c9336cef [MRG] grid_search_digits.py: Remove impact-less (and confusing) 'C=1' parameter. (#8731)
This parameter does not modify at all the behavior of GridSearchCV,
and is quite confusing for the user.
Useful values of 'C' are already set in 'tuned_parameters'.
2017-04-13 08:20:34 +10:00
Sachin Agarwal 0cae688f25 plot iso-f1 curves in plot_precision_recall (#8378) 2017-02-20 13:53:51 +01:00
Guillaume Lemaitre ec8d9f38aa [MRG] Fix aesthetic example roc crossval (#8232)
* Fix esthetic example roc crossval
2017-01-25 14:09:54 +01:00
rashchedrin 7b0b6d7344 [MRG+1] Fix confusion matrix example code (#7971)
* fixed issue 7969

* Limited number of decimal places in normalized confusion matrix

* deduplicated code
2016-12-03 15:57:15 -05:00
Joel Nothman 6e98eec043 [MRG + 1] DOC refer to code elements in nested CV example description (#7949) 2016-11-30 20:46:39 +11:00
mlliou112 5fcc7e5cf0 DOC: Added Nested Cross Validation Example (#7111) 2016-09-25 10:47:01 +10:00
Gael Varoquaux 4b2304f05a Merge pull request #7261 from betatim/negative-scorers
[MRG + 2] Rename scorers like `mse` to `neg_mse`
2016-09-08 20:40:17 +02:00
Raghav R V 4dbab2680e results_ --> cv_results_; "test_mean_score" --> "mean_test_score" et al. 2016-09-06 18:46:09 +02:00
Tim Head 6673f75828 Update examples to new scorer names 2016-09-06 11:25:11 +02:00
Yen 42120e50bb [MRG+1] Rename CV params n_{folds,iter} to n_splits (#7187)
* Rename n_iter to n_splits

* Fix bug

* Fix examples

* Add spaces

* Rename n_folds to n_splits

* Fix error

* Fix doc

* Fix doc

* Fix example

* Rename variables name

* PEP8

* Fix error message

* Add whats_new

* Fix test

* Fix doc

* Fix doc

* Make test clear
2016-08-16 13:56:55 -07:00
Óscar Nájera bd5cecce44 update references link namespace 2016-08-03 20:23:50 +02:00
Igor Andriushchenko 7b7093ceda DOC make confusion_matrix_plot.py exmaple more copy-pastable 2016-07-15 00:40:03 +03:00
hashcode55 1bec8e3937 first commit 2016-06-19 02:53:34 +05:30
Raghav R V afd5d18b0c [MRG] ENH Restructure grid_scores_ into a dict of 1D arrays
Also, DOC what's new section for model_selection changes
2016-06-16 12:23:04 +10:00
David Ellis 65c4df130b Update plot_roc_crossval.py (#6765)
List "all_tpr" was not being used.
2016-05-07 17:32:49 +02:00
seales 0485ada58b General spelling fixes 2015-12-16 09:46:42 -08:00
Raghav R V f67e911124 DOC Modify documentation/examples for the new model_selection module 2015-10-29 16:49:23 +01:00
johannah 83430819de Added colorblind compatibility 2015-10-23 19:07:46 +02:00
MartinBpr b7acd76b50 Corrected macro ROC in example plot_roc 2015-10-20 17:11:25 +02:00