Commit Graph

52 Commits

Author SHA1 Message Date
Olivier Grisel 40e6c43cb4
Joblib 0.12.2 (#11741)
* joblib 0.12.2

* Export _joblib's register_parallel_backend

* Use latest version of coverage
2018-08-03 12:34:25 +02:00
Samuel O. Ronsin 6b38970fce ENH Expose errors_score in cross_validate and cross_val_score (#11583) 2018-07-27 12:27:16 +10:00
Alexandre Boucaud f158e2dfe2 [MRG+1] Change CV defaults to 5 (#11557)
* add FutureWarning for methods with defaults=3

* add explicit cv values to fix assertion errors

* add tests for catching the FutureWarning

* Write current deprecation version

* Add deprecation in docstring

* change default cv value to None

* change cv from 3 to 5 in the examples

* upgrade doctests

* update doctest in tutorial

* update doctest in cross-validation doc

* fix tests

* add entry to whats new

* address Gael comments

* address Gael comments 2

* fix wrong indentation

* update doc

* add docstring deprecation warning in CV subclasses

* address Andy's comments

* fix PR number

* fix flake8

* add filterwarnings in tests

* fix doctests

* cv=None mendatory in Ridge

* fix warning related errors

* skip some doctests warnings

* make travis happy

* change from deprecated to versionchanged

* fix doctests and remove skipping

* address comments
2018-07-19 14:46:11 +02:00
Andreas Mueller 8e2c2aa35d
raise DeprecationWarnings and FutureWarnings as errors (#11570)
Towards #11252.
In the end we'd like to make these errors so we can keep this cleaner in the future.
2018-07-17 15:31:45 -05:00
Joel Nothman 14e7c328df Restructure access to vendored/site Joblib (#11471)
In order to fix #11408, this swaps `joblib` and `_joblib`. It however, allows users to access joblib's `Memory` or `Parallel` functionality without accessing `sklearn.externals._joblib` by importing `Memory`, `Parallel`, etc. into `sklearn.utils`.
2018-07-17 18:02:11 +02:00
Joel Nothman 14764061f8
[MRG] DOC fix some sphinx warnings (#11241) 2018-06-21 20:43:21 +10:00
chris 4905934f1a DOC Remove '=' in 'shape =' for consistency with docs (#11087) 2018-05-12 22:57:45 +08:00
Joel Nothman 83a9eab8e1 DOC more warnings about cross_val_predict misuse (#11081) 2018-05-11 09:11:47 +08:00
Loïc Estève 20661b5018
TST: only run doctests on numpy 1.14. (#10835)
Fix doctests due to numpy 1.14 formatting changes.
2018-03-27 07:44:40 +02:00
Kirill 76b5b2af57 ENH Change default error_score to raise-deprecating (#10677) 2018-03-02 18:32:42 +11:00
Aurélien Bellet d9c212297e ENH add option to cross_validate to return estimators fitted on each split (#9686) 2018-02-28 09:32:46 +11:00
Mayur Kulkarni 92c9095591 [MRG+1] FIX Improve message and exception of cross-validation FitFailedWarning (#10382) 2018-01-10 16:20:05 -08:00
Loïc Estève e7e05d844f [MRG+1] Remove nose from CIs and documentation (#9840) 2017-11-16 20:20:35 +01:00
Reiichiro Nakano ebc8730344 [MRG+1] Fix cross_val_predict behavior for binary classification in decision_function (Fixes #9589) (#9593)
* fix cross_val_predict for binary classification in decision_function

* Add unit tests

* Add unit tests

* Add unit tests

* better fix

* fix conflict

* fix broken

* only calculate n_classes if one of 'decision_function', 'predict_proba', 'predict_log_proba'

* add test for SVC ovo in cross_val_predict

* flake8 fix

* fix case of ovo and imbalanced folds for binary classification

* change assert_raises to assert_raise_message for ovo case

* fix flake8 linetoo long

* add comments and clearer tests

* improve comments and error message for OvO

* fix .format error with L

* use assert_raises_regex for better error message

* raise error in decision_function special cases. change predict_log_proba missing classes to minimum numpy value

* fix broken tests due to special cases of decision_function

* add modified test for decision_function behavior that does not trigger edge cases

* fix typos

* fix typos

* escape regex .

* escape regex .

* address comments. one unaddressed comment

* simplify code

* flake

* wrong classes range

* address comments. adjust error message

* add warning

* change warning to runtimewarning

* add test for the warning

* Use assert_warns_message rather than assert_warns

Other minor fixes

* Note on class-absent replacement values

* Improve error message
2017-10-19 17:05:43 -04:00
Kumar Ashutosh 766ba93208 [MRG+1] DEPREC Change default for return_train_score to False (#9677) 2017-10-18 10:38:53 +11:00
Gael Varoquaux 2c1d079ef2 DOC: fix docstring of learning_curve (#9689) 2017-09-05 09:29:39 +10:00
Kumar Ashutosh b441308f36 Fixes deprecation warning in numpy-dev build (#9683) 2017-09-04 10:00:15 +02:00
James Bourbeau 8f89478d58 [MRG + 1] Removes estimator method check in cross_val_predict before fitting (#9641)
* Removes check in cross_val_predict that checks estimator method before fitting

* Adds regression test for issue #9639
2017-08-29 18:13:53 -07:00
Rasul Kerimov 9e9b78dfaa [MRG+1] Resolve the problem with cross_val_predict(method=) when passing X or y as list (#9600)
* issue 9592

* issue resolve

* resolve issue

* review

* Delete sample.py

* review
2017-08-21 22:43:30 -07:00
Hanmin Qin 52fe914c13 [MRG] DOC correct the link in model_selection.cross_validate (#9537) 2017-08-13 23:49:28 +10:00
James Bourbeau fbca098c62 Modifies model_selection.cross_validate docstring (#9534)
- Fixes rendering of docstring examples
- Instead of importing cross_val_score in example, cross_validate is imported
2017-08-12 15:02:42 +03:00
Balakumaran Manoharan 04be1a9799 [MRG + 1] DOC Fix Sphinx errors (#9420)
* Fix Rouseeuw1984 broken link

* Change label vbgmm to bgmm
Previously modified with PR #6651

* Change tag name
Old refers to new tag added with PR #7388

* Remove prefix underscore to match tag

* Realign to fit 80 chars

* Link to metrics.rst.
pairwise metrics yet to be documented

* Remove tag as LSHForest is deprecated

* Remove all references to randomized_l1 and sphx_glr_auto_examples_linear_model_plot_sparse_recovery.py.
It is deprecated.

* Fix few Sphinx warnings

* Realign to 80 chars

* Changes based on PR review

* Remove unused ref in calibration

* Fix link ref in covariance.rst

* Fix linking issues

* Differentiate Rouseeuw1999 tag within file.

* Change all duplicate Rouseeuw1999 tags

* Remove numbers from tag Rousseeuw
2017-07-30 15:22:10 +10: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
Andreas Mueller 5271a193c3 MRG Sphinx fixes (#9155) 2017-06-28 17:00:13 +02:00
Aleksandr Sandrovskii 49b730f9fb [MRG+2] Clone estimator for each parameter value in validation_curve (#9119) 2017-06-14 17:12:40 +02:00
Naoya Kanai 6579220588 [MRG+1] Drop NumPy < 1.8 (#8874) 2017-06-07 17:06:06 +02:00
Guillaume Lemaitre e3c9ae204f [MRG+1] DOC improve description and consistency of random_state (#8689)
* DOC improve description of random_state in train_test_split

* DOC Make random_state consistent through documentation

* FIX reverse doc mistake

* FIX address comment of Tom

* DOC address comments

* DOC remove empty line

* DOC remove unecessary white spaces
2017-04-05 17:43:21 -07:00
leereeves cd66c5a06e [MRG+1] Improved docstring for permutation_test_score (#8379 and #8564) (#8569) 2017-03-13 09:43:55 +11:00
Aman Dalmia fd84a567b4 [MRG + 1] Fix the cross_val_predict function for method='predict_proba' (#7889)
Handle the case where different CV splits have different sets of classes present.
2017-01-08 09:24:05 +11:00
Stijn Tonk 986a49bbe0 FIX Split data using _safe_split in _permutaion_test_score (#5697)
Squashed commits:
[94fd9f4] split data using _safe_split in _permutaion_test_scorer
[522053b] adding test case test_permutation_test_score_pandas() to check if permutation_test_score plays nice with pandas dataframe/series
[21b23ce] running test_permutation_test_score_pandas on iris data to prevent warnings.
[15a48bf] adding safe_indexing to _shuffle function
[9ea5c9e] adding test case test_permutation_test_score_pandas() to check if permutation_test_score plays nice with pandas dataframe/series
[3cf5e8f] split  data using _safe_split in _permutaion_test_scorer to fix error when using Pandas DataFrame/Series
2016-12-29 02:46:53 +01:00
Raghav RV 3dcb873494 [MRG + 1] ENH Do not materialise CV splits when unnecessary (#7941)
* ENH Parallelize by candidates first then by splits.

* ENH do not materialize a cv iterator to avoid memory blow ups.
2016-12-07 21:13:42 +11:00
Raghav RV 38f6a91566 [MRG + 2] FIX Be robust to non re-entrant/ non deterministic cv.split calls (#7660) 2016-10-31 08:49:17 +11:00
Srivatsan 177ac840ab [MRG + 1] Printing the total time in cross_validation (#7640)
* print score+fit time instead of just score time when doing cross_validation

* reducing line size

* More clearer log message
2016-10-24 15:52:34 +02:00
NarineK 829efa5929 [MRG+1] Learning curve: Add an option to randomly choose indices for different training sizes (#7506)
* Chooses randomly the indices for different training sizes

* Bring back deleted line

* Rewrote the description of 'shuffle' attribute

* use random.sample instead of np.random.choice

* replace tabs with spaces

* merge to master

* Added shuffle in model-selection's learning_curve method

* Added shuffle for incremental learning + addressed Joel's comment

* Shorten long lines

* Add 2 blank spaces between test cases

* Addressed Joel's review comments

* Added 2 blank lines between methods

* Added non regression test for learning_curve with shuffle

* Fixed indentions

* Fixed space issues

* Modified test cases + small code improvements

* Fix some style issues

* Addressed Joel's comments - removed _shuffle_train_indices, more test cases and added new entry under 0.19/enhancements

* Added some modifications in whats_new.rst
2016-10-19 15:18:07 -04:00
Raghav RV b444cc9c64 [MRG+2] Timing and training score in GridSearchCV (#7325)
* Resolved issue #6894 and #6895:
    Now *SearchCV.results_ includes both timing and training scores.

wrote new test (sklearn/model_selection/test_search.py)
and new doctest (sklearn/model_selection/_search.py)
added a few more lines in the docstring of GridSearchCV and RandomizedSearchCV.
Revised code according to suggestions.
Add a few more lines to test_grid_search_results():
    1. check test_rank_score always >= 1
    2. check all regular scores (test/train_mean/std_score) and timing >= 0
    3. check all regular scores <= 1
Note that timing can be greater than 1 in general, and std of regular scores
always <= 1 because the scores are bounded between 0 and 1.

* ENH/FIX timing and training score.

* ENH separate fit / score times
* Make score_time=0 if errored; Ignore warnings in test
* Cleanup docstrings
* ENH Use helper to store the results
* Move fit time computation to else of try...except...else
* DOC readable sample scores
* COSMIT Add a commnent on why time test is >= 0 instead of > 0
  (Windows time.time precision is not accurate enought to be non-zero
   for trivial fits)

* Convey that times are in seconds
2016-09-27 20:14:33 +10:00
Russell Smith 54b0e4bf62 Add OneVs{One,All}Classifier._pairwise: fix for #7306 (#7350) 2016-09-20 13:46:45 +02:00
Raghav RV b18b1611cd [MRG+1] TST Stronger test for _check_is_permutation (#7395)
* TST Stronger test for _check_is_permutation

* TST Ensure additional duplicate indices are caught
2016-09-12 11:44:16 -04:00
Raghav RV c3b21153e8 MNT Remove unused constants from public API(?) (#6517) 2016-09-12 10:17:59 -04:00
Raghav RV 9a12555e6d [MRG+1] ENH/MNT Rename labels --> groups in CV tools (#6660) 2016-09-11 19:14:41 +02:00
Óscar Nájera 90fe87fea5 Extra missing links complained by sphinx 2016-08-03 20:23:50 +02:00
Óscar Nájera 8034b2926e more examples references 2016-08-03 20:23:50 +02:00
Andreas Mueller 8972d82a1f DOCS / COSMIT duplicate word typos 2016-07-26 10:44:32 -04:00
Joel Nothman a0ccea9406 TST avoid imports from deprecated module 2016-07-07 17:37:36 +10:00
Francis T. O'Donovan fe03879cd3 Fix doc refs to StratifiedKFold and KFold (#6936)
Fix links to `StratifiedKFold` and `KFold` in docstrings.
2016-06-28 09:22:05 +02:00
Joel Nothman 814223cbfd [MRG+1] FIX support memmap scalars as CV scores (#6789)
* FIX support memmap scalars as CV scores

* FIX test for Python 3.5 and NumPy 1.12
2016-06-01 23:34:16 -07:00
Joel Nothman a769b25715 ENH remove excessive verbosity when no parameters set for CV 2016-05-19 16:55:44 +10:00
zivori e733b28e48 model_seclection._validation.cross_val_predict_apply_func
Conflicts:
	doc/whats_new.rst
2016-04-27 10:24:34 +03:00
Alejandro Correa Bahnsen bd99858a92 [MRG +1] DOC - add example to cross_val_predict and cross_val_score (#6446)
* add example to cross_val_predict and cross_val_score

* fix output of cross_val_predict

* add example to cross_val_predict and cross_val_score

* fix output of cross_val_predict

* fix rebase
2016-04-20 10:03:55 +02:00
Okhlopkov Daniil Olegovich 4eca0c986e updated info for cross_val_score
added link to sclera.metrics.make_scorer
2016-03-14 23:13:11 +03:00
Raghav R V 99c73a89e0 DOC Reworded cv documentation 2016-01-08 00:53:54 -05:00