Commit Graph

162 Commits

Author SHA1 Message Date
Andreas Mueller 952ef6637a MRG Drop legacy python / remove six dependencies (#12639) 2019-01-03 15:50:05 +02:00
Bartosz Michałowski fa98a72dcc MNT Replaced all occurrences of assert_true and assert_false with assert (#12588) 2018-11-28 09:16:26 +08:00
Hanmin Qin 43e3a02085
MNT Remove unused assert_true imports (#12560) 2018-11-11 11:08:37 +08:00
Yaroslav Halchenko 362cb3bcab TST autoreplace assert_true(...==...) with plain assert (#12547) 2018-11-11 09:05:34 +08:00
Nicolas Hug 4e2da4af92 [MRG] Added FutureWarning in sgd models for tol parameter (#12399)
* Added ChangedBehaviorWarning in sgd models

if tol is None while max_iter is set

* Changed to FutureWarning and clarified None meaning

* Ignored warningin tests

* Ignore warnings in tests, round 2
2018-10-24 11:00:43 -04:00
Joel Nothman 7ed61a24fe ENH add multi_class='auto' for LogisticRegression, default from 0.22; default solver will be 'lbfgs' (#11905)
* Change default solver in LogisticRegression
* This is an API change, not a feature
* Decrease numerical precision in LogisticRegression doctest
* ENH add multi_class='auto' for LR, default from 0.22
* No warning when binary
2018-08-26 23:00:02 +03:00
Brent Yi e28a57747f Add min_features_to_select parameter to RFECV (#11293) 2018-08-09 08:44:36 +03: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
annaayzenshtat 2242c59fc8 [MRG] EHN: Change default n_estimators to 100 for random forest (#11542)
<!--
Thanks for contributing a pull request! Please ensure you have taken a look at
the contribution guidelines: https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md#pull-request-checklist
-->

#### 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
-->
Fixes #11128.

#### What does this implement/fix? Explain your changes.
Issues deprecation warning message for the default n_estimators parameter for the forest classifiers. Test added for the warning message when the default parameter is used.

#### Any other comments?


<!--
Please be aware that we are a loose team of volunteers so patience is
necessary; assistance handling other issues is very welcome. We value
all user contributions, no matter how minor they are. If we are slow to
review, either the pull request needs some benchmarking, tinkering,
convincing, etc. or more likely the reviewers are simply busy. In either
case, we ask for your understanding during the review process.
For more information, see our FAQ on this topic:
http://scikit-learn.org/dev/faq.html#why-is-my-pull-request-not-getting-any-attention.

Thanks for contributing!
-->
2018-07-17 14:42:59 -05:00
Nihar Sheth 211ded8fbc [MRG+1] Select k-best features in SelectFromModel (#9616)
#### Reference Issue
Continuation of work from [PR #6717](https://github.com/scikit-learn/scikit-learn/pull/6717).


#### What does this implement/fix? Explain your changes.
Will merge in master (this branch is a year old) and make changes as discussed in previous PR discussion to make it ready for merging in.
2018-07-16 14:15:25 -05:00
Roman Yurchak f049ec72eb TST Pytest parametrization part3 - feature_extraction, gaussian_process modules (#11143) 2018-06-04 22:23:29 +08:00
Nick Hoh 1755b893df [MRG+2] Fix edge case of tied CV scores in RFECV (#9222)
* Fix edge case of tied CV scores in RFECV

In the feature_selection module, RFECV selects the model with the
highest cross-validation score. In the event of CV score ties, one
expects RFECV to return the best model with the fewest features.
This fix addresses such an edge case where two or more models have
identical cross-validation scores.

* Adding an entry to what's new addressing bug fix in RFECV edge case

* Re-add what's new entry

* Use double backticks in whats_new entry
2018-05-24 12:03:29 -04:00
Adam Greenhall 48b82a6ff5 [MRG+1] add groups support to RFECV (#9656) 2017-11-17 16:35:49 +01:00
Joel Nothman 49af61cb42 TST Improve SelectFromModel tests (#9733)
Should fix one of the issues in #9393
2017-09-20 17:29:42 +02:00
Bastian Venthur 7400775633 [MRG+1] MAINT Replace assert_array_equal with -assert_array_almost_equal where necessary. (#9774) 2017-09-18 19:55:23 +10:00
Sebastin Santy dc43486806 Remove unused imports (#9235) 2017-07-01 05:57:54 -07:00
Tom Dupré la Tour edeb3af217 Deprecate n_iter in SGDClassifier and implement max_iter (#5036) 2017-06-23 21:49:29 +02:00
Thomas Moreau 8dde4096bd [MRG] ENH make rng seed thread safe everywhere it is possible (#9184)
* ENH make rng seed thread safe everywhere it is possible

* ENH remove unneeded use of np.random.seed
2017-06-23 07:40:33 +02:00
Naoya Kanai 6579220588 [MRG+1] Drop NumPy < 1.8 (#8874) 2017-06-07 17:06:06 +02:00
Andreas Mueller 1c41368bac [MRG+1] Uncontroversial fixes from estimator tags branch (#8086)
* some bug fixes.

* minor fixes to whatsnew

* typo in whatsnew

* add test for n_components = 1 transform in dict learning

* feature extraction doc fix

* fix broken test

* revert aggressive input validation changes

* in SelectFromModel, don't store threshold_ in transform. If we called "fit", use estimates from last "fit".

* move score from EllipticEnvelope to OutlierDetectionMixin

* revert changes to Tfidf documentation

* remove dummy input validation from whatsnew

* fix text feature tests

* rewrite from_model threshold again...

* remove stray condition

* fix self.estimator -> estimator, slightly more interesting test

* typo in comment

* Fix issues in SparseEncoder, add tests.
more explicit explanation of SparseEncoder change, add issue numbers to whatsnew

* minor fixes in whats_new.rst

* slightly more consistency with tuples for shapes

* not longer typo
2017-06-06 16:34:47 +02:00
Guillaume Lemaitre aaebee1f6b FIX Issue #8173 - pass n_neighbors in MI computation (#8181) 2017-01-19 17:37:05 +01:00
Daniel LeJeune 456fb5697f [MRG + 2] Allow f_regression to accept a sparse matrix with centering (#8065)
* Updated centering for f_regression

Allows f_regression to accept a sparse matrix when centering=True.

* Fixed E226 spacing issue.

* Added f_regression sparse update to whats_new.rst
2016-12-20 14:23:32 +01: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
Andreas Mueller 9dfe0189fa TST do the warning test as we do it in other places. (#7858) 2016-11-16 20:17:14 +11:00
Andreas Mueller 9667ff292f [MRG + 2] Fixed parameter setting in SelectFromModel (#7764)
* Fixed cloning ``estimator`` again when calling fit a second time in SelectFromModel

* fix link in whatsnew
2016-11-09 20:34:04 +01:00
Arthur Douillard 2ddf0ce633 [MRG + 1] rfecv: verbosity: Set verbose threshold low bound from 2 to 1 (#7644)
* rfecv: verbosity: Set verbose threshold low bound from 2 to 1

* rfecv: verbosity: Add test checking verbose=1 produce output

* rfecv: verbosity: Change docstring to comment

* rfecv: verbosity: Fix test, missing seek
2016-10-31 08:50:35 -07:00
Antoine Wendlinger 74a9756fa7 [MRG+2] Norm inconsistency between RFE and SelectFromModel (was _LearntSelectorMixin) #2121 (#6181)
* Norm inconsistency between RFE and SelectFromModel (was _LearntSelectorMixin) #2121

* safe_pwr utility

* Norm fix

* Removed safe_pwr

* 1D arrays support for norm fix

* Test case for 2d coef in SelectFromModel

* Fix numpy version requirement for norm fix

* Implement fixes suggested by @jnothman

* Add numpy version requiring the fix.
2016-10-24 14:01:49 -04:00
affanv14 ee3e61754b [MRG+2] adding multilabel support for score_func (#7676)
* added multilabel support for score function

* added test for multilabel score function

* updated whats_new.rst

* updated whats_new.rst with working link
2016-10-20 13:08:23 -04:00
Meng, Peng 2caa1445fb [MGR + 2] fix selectFdr bug (#7490) 2016-10-20 13:06:32 +11:00
Konstantin Podshumok 9b2aac9e5c [MRG + 1] [TST] (half-cosmetic) use less nose.tools import to simplify future transition to py.test (#7384)
* use less nose.tools import to simplify future transition to activly developing test suites/runners

* assert_equal -> assert_array_equal in test_feature_hasher_pairs_with_string_values

and one missed ImportError that should be replaced with AttributeError

* test for py2.6 compat with except AttributeError

* fix importing of SkipTest

* force using nose in python2.6 for now

* there was no assert_dict_equal in py2.6. but we can use assert_equal

although failed test will look a little bit ugly

* remove nose imports from doc/datasets
2016-10-07 12:46:52 -04:00
Charlton Austin ec32689ae9 [MRG+1] Fixing error with step parameter #7467 (#7469)
* Fixing error with step parameter #7467. Basically converting the step parameter the same way RFE does.

* Adding in an explanation to the test case.

* Moving the location of where we set the data.

* Adding in an assertion against the data.
2016-09-29 20:41:43 -07:00
Joel Nothman 62ad5fed90 FIX Revert unintentionally committed code 2016-09-08 18:47:02 +10:00
Joel Nothman 22e43054fc TST fix test to match altered deprecation msg 2016-09-08 10:29:06 +10:00
Gael Varoquaux 91129f35e5 Merge pull request #7119 from jrfiedler/remove-unused-imports
[MRG] Removed unused imports
2016-08-01 16:17:18 -07:00
Joel Nothman 9539c0c00e [MRG + 1] ENH show no warning with chi2 of empty feature (#6978)
* ENH show no warning with chi2 of empty feature

* TST better error message when warnings raised

* TST fix test in old Numpy where another warning is issued
2016-07-31 09:35:19 +02:00
James Fiedler e4b837cc66 Removed unused imports 2016-07-29 19:30:23 -05:00
Nikolay Mayorov 5b3f51515b MAINT: Get rid of classes in test_mutual_info.py 2016-01-22 00:27:16 +05:00
Nikolay Mayorov 375b070263 TST: Speed up 2 tests related to mutual info 2016-01-22 00:27:16 +05:00
Nikolay Mayorov d3a497aec4 BUG: Fix copy logic for mutual info functions 2016-01-22 00:27:16 +05:00
Nikolay Mayorov 051d3a285d MAINT: Slightly improve logic of discrete-continuous MI estimation 2016-01-22 00:27:16 +05:00
Nikolay Mayorov ffc4fe91da TST: Change tolerance checks in test_mutual_info.py 2016-01-22 00:27:16 +05:00
Nikolay Mayorov 835102ab6a API: Split mutual_info into _regression and _classif 2016-01-22 00:27:15 +05:00
Nikolay Mayorov c1aea3f868 MAINT: Renamed module mutual_info to mutual_info_ 2016-01-22 00:27:15 +05:00
Nikolay Mayorov df08defb05 ENH: Implemented mutual_info function 2016-01-22 00:27:15 +05:00
seales 0485ada58b General spelling fixes 2015-12-16 09:46:42 -08:00
MechCoder d13f519ba5 Parallelize embarrassingly parallel loop in RFECV.fit 2015-12-06 20:58:06 -05:00
Andreas Mueller 776e53b127 skip unstable tests on 32bit platform 2015-11-02 15:21:22 -05:00
Raghav R V 3f8743f47b Main Commits - Major
--------------------

* ENH Reogranize classes/fn from grid_search into search.py
* ENH Reogranize classes/fn from cross_validation into split.py
* ENH Reogranize cls/fn from cross_validation/learning_curve into validate.py

* MAINT Merge _check_cv into check_cv inside the model_selection module
* MAINT Update all the imports to point to the model_selection module
* FIX use iter_cv to iterate throught the new style/old style cv objs
* TST Add tests for the new model_selection members
* ENH Wrap the old-style cv obj/iterables instead of using iter_cv

* ENH Use scipy's binomial coefficient function comb for calucation of nCk
* ENH Few enhancements to the split module
* ENH Improve check_cv input validation and docstring
* MAINT _get_test_folds(X, y, labels) --> _get_test_folds(labels)
* TST if 1d arrays for X introduce any errors
* ENH use 1d X arrays for all tests;
* ENH X_10 --> X (global var)

Minor
-----

* ENH _PartitionIterator --> _BaseCrossValidator;
* ENH CVIterator --> CVIterableWrapper
* TST Import the old SKF locally
* FIX/TST Clean up the split module's tests.
* DOC Improve documentation of the cv parameter
* COSMIT consistently hyphenate cross-validation/cross-validator
* TST Calculate n_samples from X
* COSMIT Use separate lines for each import.
* COSMIT cross_validation_generator --> cross_validator

Commits merged manually
-----------------------

* FIX Document the random_state attribute in RandomSearchCV
* MAINT Use check_cv instead of _check_cv
* ENH refactor OVO decision function, use it in SVC for sklearn-like
  decision_function shape
* FIX avoid memory cost when sampling from large parameter grids

ENH Major to Minor incremental enhancements to the model_selection

Squashed commit messages - (For reference)

Major
-----

* ENH p --> n_labels
* FIX *ShuffleSplit: all float/invalid type errors at init and int error at split
* FIX make PredefinedSplit accept test_folds in constructor; Cleanup docstrings
* ENH+TST KFold: make rng to be generated at every split call for reproducibility
* FIX/MAINT KFold: make shuffle a public attr
* FIX Make CVIterableWrapper private.
* FIX reuse len_cv instead of recalculating it
* FIX Prevent adding *SearchCV estimators from the old grid_search module
* re-FIX In all_estimators: the sorting to use only the 1st item (name)
    To avoid collision between the old and the new GridSearch classes.
* FIX test_validate.py: Use 2D X (1D X is being detected as a single sample)
* MAINT validate.py --> validation.py
* MAINT make the submodules private
* MAINT Support old cv/gs/lc until 0.19
* FIX/MAINT n_splits --> get_n_splits
* FIX/TST test_logistic.py/test_ovr_multinomial_iris:
    pass predefined folds as an iterable
* MAINT expose BaseCrossValidator
* Update the model_selection module with changes from master
  - From #5161
  -  - MAINT remove redundant p variable
  -  - Add check for sparse prediction in cross_val_predict
  - From #5201 - DOC improve random_state param doc
  - From #5190 - LabelKFold and test
  - From #4583 - LabelShuffleSplit and tests
  - From #5300 - shuffle the `labels` not the `indxs` in LabelKFold + tests
  - From #5378 - Make the GridSearchCV docs more accurate.
  - From #5458 - Remove shuffle from LabelKFold
  - From #5466(#4270) - Gaussian Process by Jan Metzen
  - From #4826 - Move custom error / warnings into sklearn.exception

Minor
-----

* ENH Make the KFold shuffling test stronger
* FIX/DOC Use the higher level model_selection module as ref
* DOC in check_cv "y : array-like, optional"
* DOC a supervised learning problem --> supervised learning problems
* DOC cross-validators --> cross-validation strategies
* DOC Correct Olivier Grisel's name ;)
* MINOR/FIX cv_indices --> kfold
* FIX/DOC Align the 'See also' section of the new KFold, LeaveOneOut
* TST/FIX imports on separate lines
* FIX use __class__ instead of classmethod
* TST/FIX import directly from model_selection
* COSMIT Relocate the random_state documentation
* COSMIT remove pass
* MAINT Remove deprecation warnings from old tests
* FIX correct import at test_split
* FIX/MAINT Move P_sparse, X, y defns to top; rm unused W_sparse, X_sparse
* FIX random state to avoid doctest failure
* TST n_splits and split wrapping of _CVIterableWrapper
* FIX/MAINT Use multilabel indicator matrix directly
* TST/DOC clarify why we conflate classes 0 and 1
* DOC add comment that this was taken from BaseEstimator
* FIX use of labels is not needed in stratified k fold
* Fix cross_validation reference
* Fix the labels param doc

FIX/DOC/MAINT Addressing the review comments by Arnaud and Andy

COSMIT Sort the members alphabetically
COSMIT len_cv --> n_splits
COSMIT Merge 2 if; FIX Use kwargs
DOC Add my name to the authors :D
DOC make labels parameter consistent
FIX Remove hack for boolean indices; + COSMIT idx --> indices; DOC Add Returns
COSMIT preds --> predictions
DOC Add Returns and neatly arrange X, y, labels
FIX idx(s)/ind(s)--> indice(s)
COSMIT Merge if and else to elif
COSMIT n --> n_samples
COSMIT Use bincount only once
COSMIT cls --> class_i / class_i (ith class indices) -->
perm_indices_class_i

FIX/ENH/TST Addressing the final reviews

COSMIT c --> count
FIX/TST make check_cv raise ValueError for string cv value
TST nested cv (gs inside cross_val_score) works for diff cvs
FIX/ENH Raise ValueError when labels is None for label based cvs;
TST if labels is being passed correctly to the cv and that the
ValueError is being propagated to the cross_val_score/predict and grid
search
FIX pass labels to cross_val_score
FIX use make_classification
DOC Add Returns; COSMIT Remove scaffolding
TST add a test to check the _build_repr helper
REVERT the old GS/RS should also be tested by the common tests.
ENH Add a tuple of all/label based CVS
FIX raise VE even at get_n_splits if labels is None
FIX Fabian's comments
PEP8
2015-10-23 17:28:08 +02:00
Arnaud Rachez 5db2adf93c MAINT Removed deprecated stuff. 2015-10-21 10:24:23 +02:00
Raghav R V a87011262a FIX precision to float64 across the codebase 2015-10-16 11:20:29 +02:00