Commit Graph

109 Commits

Author SHA1 Message Date
Hanmin Qin 41b84f84cc [MRG+1] Change the restriction of n_repeats in RepeatedKFold and RepeatedStratifiedKFold (#8909)
* change the restriction of n_repeats

* change test case
2017-06-05 16:51:17 +02:00
Naoya Kanai bd0fc236e0 [MRG+1] MAINT drop SciPy < 0.13 (#8854)
Remove sklearn.utils.fixes functions that are not needed for scipy >= 0.13 and keep deprecated wrappers in other modules.
2017-06-02 23:36:33 +02:00
Joel Nothman 7ce7134a57 [MRG+2] ENH Loop over candidates as outer loop in search (#8322)
This encourages concurrent fits to be over *different datasets* so that
fits over the same data subset are more likely to run in serial and
hence generate cache hits where memoisation is used.
2017-06-01 16:29:34 +02:00
Guillaume Lemaitre 92cb166647 [MRG] DOC Homogeneous deprecation in docstring (#8907)
Update developers doc to use "deprecated" sphinx directive.
2017-05-23 08:42:08 +02:00
Hanmin Qin e19bb7ce5a Fix n_splits in KFold instantiation in model_selection tests (#8910) 2017-05-21 01:35:02 -04:00
Toshihiro Kamishima 754109c78d [MRG+1] enable to use get_n_splits of LeaveOneGroupOut and LeavePGroupsOut with dummy parameters (#8794)
* remove needless argument checking

* add parameter checking as in LeavePGroupsOut

* add examples with dummy inputs

* add unittest for a get_n_splits method in LeaveOneGroupOut and LeavePGroupsOut classes

* X and y can be ommited in a get_n_splits function.

* fix error messages

* update examples

* fix test for an error message

* Revert "fix test for an error message"

This reverts commit 68b984207c.

* fix test for an error message

* fix error messages

* remove tailing white spaces

* add periods to messages

* test for ValueError’s of get_n_splits methods of LeaveOneOut / LeavePOut classes

* fix documents:
* parameter name: group -> groups
* modfy white space
2017-05-12 14:56:13 +02:00
AishwaryaRK b57837188d [MRG] Fixes #8736 add get_n_splits for RepeatedKFold and RepeatedStratifiedKFold (#8802) 2017-04-29 21:33:32 +10:00
Ilya 4d31e55b0e Fix typo in GridSearchCV documentation (#8739) 2017-04-13 20:47:04 +10: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
Neeraj Gangwar af1796ef68 [MRG+1] Repeated K-Fold and Repeated Stratified K-Fold (#8120)
* Add _RepeatedSplits and RepeatedKFold class

* Add RepeatedStratifiedKFold and doc for repeated cvs

* Change default value of n_repeats

* Change input parameters of repeated cv constructor to n_splits, n_repeats, random_state

* Generate random states in split function rather than store it beforehand

* Doc changes, inheriting RepeatedKFold, RepeatedStratifiedKFold from _RepeatedSplits and other review changes

* Remove blank line, put testcases for deterministic split in loop and add StopIteration check in testcase

* Using rng directly as random_state param to create cv instance and added a check for cvargs

* Fix pep8 warnings

* Changing default values for n_splits and n_repeats and add entry in changelog

* Adding name to the feature

* Missing space
2017-03-04 15:39:04 -05:00
akshay0724 676e863024 [MRG+1] Fix ug in BaseSearchCV.inverse_transform (#8348) 2017-02-17 17:12:51 +01:00
Stephen Hoover eee8be490b [MRG+1] Add classes_ parameter to hyperparameter CV classes (#8295) 2017-02-10 08:36:20 +01:00
Stephen Hoover 3a0ea190c5 [MRG+1] Accept keyword parameters to hyperparameter search fit methods (#8278)
* ENH Accept keyword parameters to hyperparameter search fit methods

Deprecate ``fit_params`` as a constructor argument to the hyperparameter search classes and instead accept keyword parameters to the ``fit`` methods. This makes the ``fit`` methods of these functions conform to the Estimator API and allows the use of hyperparameter search functions in other CV utility functions such as ``cross_val_predict``.

* CR: Expanded tests, remove deprecated use in Ridge

* Make tests consistent in Python 2 and 3
2017-02-09 07:42:23 +01: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
(Venkat) Raghav (Rajagopalan) 2f7f5a1a50 [MRG + 1] Add fowlkess-mallows and other supervised cluster metrics to SCORERS dict so it can be used in hyper-param search (#8117)
* Add supervised cluster metrics to metrics.scorers

* Add all the supervised cluster metrics to the tests

* Add test for fowlkes_mallows_score in unsupervised grid search

* COSMIT: Clarify comment on CLUSTER_SCORERS

* Fix doctest
2017-01-06 12:03:10 +01: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
Andreas Mueller 5d0c7f5cdc [MRG+1] allow callable kernels in cross-validation (#8005) 2016-12-20 20:10:04 +11:00
Andreas Mueller 5c4b1bb231 [MRG+1] Housekeeping Deprecations for v0.19 (#7927)
* remove stuff to be removed 0.19

* more changes

* remove classes from 0.19 whatsnew

* remove _LearntSelectorMixin

* remove ProjectedGradientNMF, load_lwf_*

* minor fixes

* remove more copy from logistic regression path

* remove lda, qda from __init__.__all__

* remove pg solver in nmf from tests etc

* remove class_weight="auto" from tests

* doctest change for decision_function_shape="ovr"

* remove transfrom from tree test, minor fixes to tree tests

* some fixes in the tests

* undo changes in functions which still allow 1d input...

* also allow 1d in scale

* more test fixes...

* last test fixes in forest and tree

* svm default value change doctest failures

* pep8

* remove more class_weight="auto" stuff

* minor cosmetics in docstrings deprecated / removed behavior.

* say that store_covariance has been moved to __init__ in discriminant_analysis
2016-12-09 12:43:38 -05: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
Loïc Estève 34968d4c5d Fix tests on numpy master (#7946)
Until now we were in a edge case on assert_array_equal
2016-11-29 21:50:56 +01:00
Joel Nothman 7e18252a9e COSMIT remove unused import (#7928) 2016-11-24 11:33:56 +11:00
Loïc Estève e5bf61eee1 [MRG+1] Dropping python 2.6 support (#7890)
* Remove Python 2.6 support

Some details about some slightly orthogonal changes:
* Note about cheking safely for nan is likely not valid any more (commit
  introducing it is c80ca91b)
* scipy.linalg.qr econ parameter removed since scipy 0.9 in favour of
  mode='economic'
* Remove unnecessary libgfortran in conda create command

* Putative fix by setting the random seed

* Revert unintended change

* Reinstate previous logic for checking for NaNs

* Reinstate change in error message

Error messages from Python 2.7 assertRegexp does not contain the
function name, in contrast with Python 3 assertRegex
2016-11-23 17:11:04 -05:00
Raghav RV 680a5b8a95 [MRG + 1] DOC Add whatsnew for the 3 model_selection bugfixes (#7868)
* DOC Add whatnew for the 3 mod-sel bugfixes

* Move to 0.18.1; Change name universally to Raghav RV

* Raghav R V --> Raghav RV

* Edit mailmap to include my other email
2016-11-15 11:25:41 +01:00
Raghav RV d7c956afc8 [MRG] FIX Validate and convert X, y and groups to ndarray before splitting (#7593) 2016-11-04 09:48:47 +11:00
Rafael Possas 304c67cab6 COSMIT delete untrue and obsolete comment 2016-11-02 00:39:57 +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
polmauri 73d3f03cfc [MRG + 1] FIX raise an error message when n_groups > number of groups (#7681) (#7683)
* FIX raise an error message when n_groups > actual number of groups (#7681)

This change addresses issue #7681:
- Raise ValueError when n_groups > actual number of unique groups in LeaveOneGroupOut and LeavePGroupsOut.
- Add unit test.

* Make requested changes

- Check error message with `assert_raise_message`
- Pass parameters to `assert_raise_message` instead of defining functions

* Update condition and exception message
2016-10-25 11:42:39 -04: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
Andreas Mueller 716819b5a3 explain learning_curve(shuffle=True) test. 2016-10-20 10:08:37 -04: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 868a58b2e0 [MRG+1] FIX Make sure GridSearchCV and RandomizedSearchCV are pickle-able (#7594)
* FIX Subclass a new MaskedArray which allows pickling even when dype=object

* TST unpickling too

* FIX Use MaskedArray from utils.fixes rather than from numpy

* FIX imports

* Don't assign a variable

* FIX np --> numpy

* Use tostring instead of tobytes for old numpy

* COSMIT pickle-able --> picklable

* use #noqa comment to turn off flake8

* TST/ENH Check if the pickled est's predict matches with the original one's
2016-10-10 15:33:44 -04:00
Jonathan Rahn 3fbfb1bf5e fix typo in RandomizedSearchCV docs (#7564)
add missing ' in RandomizedSearchCV docs
2016-10-03 16:18:49 -04:00
Raghav RV 3619bd386b BUGFIX _store train_scores only if return_train_score is True (#7535) 2016-09-29 20:53:25 -07: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
Yichuan Liu 3dffa08e43 FIX 7155: GridSearchCV predict_proba delegation to SDGClassifier 2016-09-12 20:47:21 +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
Andreas Mueller 31a4691d76 [MRG+1] fix sampling in stratified shuffle split (#6472)
Fix sampling in stratified shuffle split, break tests that test sampling.
2016-09-09 19:00:49 +02: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
b0noI a03db89eba [MRG+1] Support of the collections.Sequence type has been added to the _check_param_grid method from model_selection. (#7323)
* Support of the collections.Sequence type has been added to the _check_param_grid method from model_selection.

* test_grid_search_when_param_grid_includes_range test was refactored (parts that are not nessesary have been removed).

* test_grid_search_bad_param_grid now checks that value is not string. This is important since string is a Sequence.

* _check_param_grid now checks is the type is not string together with the check for other types.

* whats_new.rst has been updated to include information about bug fix for bug #7322.

* Description of the fix for the bug #7322 has been updated.

* Fix for indented in model_selection._search.py.
2016-09-07 17:06:44 -04:00
Raghav R V 4dbab2680e results_ --> cv_results_; "test_mean_score" --> "mean_test_score" et al. 2016-09-06 18:46:09 +02:00
Olivier Grisel db56cf467e Merge pull request #7216 from b0noI/master
[MRG+1] New text for the ValueError that is thrown by _check_param_grid method
2016-08-31 15:27:58 +02:00
Viacheslav V Kovalevskyi f906b9f564 Lines over 81 chracter length got reformatted. 2016-08-30 21:06:54 -07:00
Viacheslav V Kovalevskyi 47eae84f8d MockClassifier has been added to the _grid_search tests. 2016-08-29 20:48:36 -07:00
Viacheslav V Kovalevskyi 401d2a178c Test method test_grid_search_incorrect_param_grid has been renamed to test_grid_search_param_grid_includes_sequence_of_a_zero_length. 2016-08-28 16:30:49 -07:00
Viacheslav V Kovalevskyi 058546215f Tests that are checking that _grid_search method throws correct ValueError have been added. 2016-08-28 15:31:33 -07:00
Tim Head 9d695d730f Keep old metric names for deprecation period
Maintain old names during the deprecation period and update
tests to use better variables names.
2016-08-27 21:11:38 +02:00