Commit Graph

246 Commits

Author SHA1 Message Date
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
Joan Massich 6de7957d97 TST Ignore warnings in common test to avoid collection errors (#12093) 2018-09-17 09:53:31 +10:00
Ronan Lamy 5592a2eda9 [MRG] PyPy support for all but a couple of estimators (#11010) 2018-07-20 14:39:53 +10:00
Andreas Mueller 2f3cc078ea I swear it'll work now... maybe 2018-07-17 18:20:51 -05:00
Shangwu Yao cb1dbc25a7 MNT: reduce the number of warnings in test_common.py (#11151)
Improve handling of warning filters in sklearn.utils.testing by avoiding to reset warnings.filters.
2018-06-11 08:59:12 +02:00
Andreas Mueller 51fe7a52ad TST make parametrized tests with partial have better displayed names (#11132) 2018-05-24 21:52:50 +02:00
Roman Yurchak 67cc975f46 [MRG+1] MAINT Parametrize common estimator tests with pytest (#11063) 2018-05-07 12:12:55 +02:00
cclauss 79053af976 execfile(): Use feature detection, not version detection (#10532)
* Follows Python porting best practice of [use feature detection instead of version detection](https://docs.python.org/3/howto/pyporting.html#use-feature-detection-instead-of-version-detection).  
 * Remove execfile() call in both Python 2 & Python 3
2018-01-25 23:11:13 +01:00
RAKOTOARISON Herilalaina 72fb54c767 [MRG+1] - No private setting in __init__ apart from parameters (#9450) 2017-12-13 12:19:56 +01:00
Loïc Estève a13a7d8d20 MAINT remove _named_check (#10160)
which was a nose-specific thing to have good names for tests using yield
2017-11-17 12:37:29 -05:00
FarahSaeed b2723582f2 [MRG] DOC Replacing "the scikit" with "scikit-learn" (#10126) 2017-11-14 11:06:50 +01:00
Andreas Mueller d788dcb199 [MRG+1] Instance level common tests (#9019)
* start work on separating instance-level tests

* minor refactoring / fixes to work without tags

* add clone into check_supervised_y_2d estimator check (which made other checks fail)

* remove duplicate check_estimator_unfitted assert

* add issue reference to whatsnew entry

* added some clones, minor fixes from vene's review

* rename estimator arg to estimator_org to make a visible distinction before and after cloning.

* more renaming for more explicit clones

* org -> orig

* allclose, fix orig stuff

* don't use set_testing_parameters in the checks!

* minor fixes for allclose

* fix some test, add more tests on classes

* added the test using pickles.

* move assert_almost_equal_dense_sparse to utils.testing, rename to assert_allclose_sparse_dense, test it

* make assert_allclose_dense_sparse more stringent

* more allclose fixes

* run test_check_estimator on all estimators

* rename set_testing_parameters to set_checking_parameters so nose doesn't think it's a tests (and I don't want to import stuff from nose as we want to remove it)

* fix in set_checking_parameters so that common tests pass

* more fixes to assert_allclose_dense_sparse

* rename alg to clusterer, don't scream even though I really want to

* ok this is not a pretty strict test that runs check_estimator with and without fitting on an instance. I also check if ``fit`` is called on the instance that is passed.

* simplify test as they didn't help at all

* it works!!! omfg

* run check_estimator clone test only on one of the configs, don't run locally by default

* Add `slow_test` decorator and documentation

* run test_check_estimator only on some estimators

* fix diags in test for older scipy

* fix pep8 and shorten

* use joblib.hash for inequality check because the pickle state machine is weird
2017-06-09 16:33:57 +02:00
Alexander Junge 568c002325 [MRG + 1] Move n_iter and get_params invariance tests to common estimator_checks (#7677)
* Test get_params invariance in common estimator tests

Remove test_get_params_invariance() from `test_common.py` and add
test call to _yield_all_tests() in `estimator_checks.py` to make
sure that get_params(deep=False) of a given Estimator returns a
subset of get_params(deep=True).

Compared to test_get_params_invariance(), it is NOT tested anymore
whether the given Estimator has an attribute get_params since
class BaseEstimator in `base.py` defines such an attribute
for each Estimator.

Partially addresses issue #7533
Also related to issue #4465

* Move test_transformer_n_iter() to estimator_checks.py

Remove the test test_transformer_n_iter() from tests/test_common.py
and perform the test logic in utils/estimator_checks.py instead.
Specifically, the method _yield_transformer_checks() now yields
check_transformer_n_iter() as part of the set of tests for
transformers.

test_transformer_n_iter() tests that that transformers with an
attribute max_iter, return the attribute of n_iter at least 1.

Partially addresses latter part of issue #7533

* Move test_non_transformer_estimators_n_iter() to estimator_checks.py

Remove the test_non_transformer_estimators_n_iter() from
tests/test_common.py; perform the test logic in
utils/estimator_checks.py instead.
Specifically, the method _yield_non_meta_checks() now yields
check_non_transformer_estimators_n_iter().

test_transformer_n_iter() tests that that estimators that are not
transformers with an attribute max_iter, return the attribute n_iter
of at least 1.

NOTE: The current implementation makes said test run for more
estimators than before this commit.
For some of these estimators, the test fails. This needs to be addressed
(see FIXME in line 111-115 of utils/estimator_checks.py for a potential
place to start).

Partially addresses latter part of issue #7533

* Fix check_non_transformer_estimators_n_iter calls

test_transformer_n_iter() test is now only run for
estimators where the test is applicable.

Partially addresses latter part of issue #7533

* Run check_non_transformer_estimators_n_iter on multi-class estimators

To do this, use helper method multioutput_estimator_convert_y_2d.
Also remove multi_output parameter from
check_non_transformer_estimators_n_iter since this parameter is not
used anywhere and corresponding cases should be handled by said
helper method.

Also, some pep8 line length fixes.

* Fix documentation for n_iter tests

There was some confusion between attributes and parameters.
Also rename n_iter to n_iter_
2016-10-20 10:23:15 -04:00
Andreas Mueller 1dff0aec21 clean up deprecation warning stuff in common tests
minor fixes in preprocessing tests
2016-09-22 19:35:31 +05:30
Joel Nothman e222058dda Make named_check private 2016-09-16 06:46:50 +10:00
Joel Nothman 1578eddef4 TST move test naming and use inspect 2016-09-14 11:11:04 +10:00
Andreas Mueller 7fc41768b1 pep8 2016-08-31 22:37:23 -04:00
Andreas Mueller 61bfe8aea8 make more explicit which checks are run 2016-08-31 18:00:55 -04:00
blakeflei 536b26a029 [MRG + 1] update test_common.py deprecation warning (#7024)
* update test_common.py deprecation warning

* Updated test_common.test_get_params_invariance to omit deprecation warnings on deprecated classes per issue 7006
2016-07-17 15:48:03 -05:00
Joel Nothman f9b1365108 TST ensure tests are importable 2016-06-13 20:29:46 +10:00
Alexandre Gramfort 7c886e483b fix pep8 2016-06-11 11:06:27 +02:00
jackmartin e04755129f pep8
fixed whitespace
2016-06-10 18:55:05 -04:00
Joel Nothman a2e0bd27d4 PEP8 2016-06-10 00:29:04 +10:00
seales 0485ada58b General spelling fixes 2015-12-16 09:46:42 -08:00
TomDLT d439dc4d9e FIX class_weight in LogisticRegression and LogisticRegressionCV 2015-10-21 17:41:39 +02:00
Vighnesh Birodkar 735dd1fdca Fix warnings during tests 2015-10-08 14:52:21 -04:00
TomDLT 94eb61960a ENH add sag solver in LogisticRegression and Ridge 2015-09-10 13:28:02 -04:00
Danny Sullivan 4ceffe05a1 Adding Implementation of SAG 2015-09-10 13:27:04 -04:00
Vighnesh Birodkar 2f099334f9 MAINT deprecate 1d input arrays for all estimators
Passing 1D arrays to check_array, without setting `ensure_2d` to false now
raises a deprecation warning before reshaping it. This will later throw an
error.

All Scaler classes also throw warnings when 1D arrays are passed.

All unit tests/doctests are modified to ensure that no 1D arrays are passed,
except in explicit 1D array tests where the warnings have been silenced.

Additional tests are also included which check for different 1D array cases.

2D array tests with one samples and one features are also added and where
they failed, `check_array` call has been modified to give a more useful error
message
2015-09-09 15:49:58 +02:00
Olivier Grisel ff64c3a744 MAINT remove referrence to HMM in common tests 2015-06-18 15:20:10 +02:00
Andreas Mueller eedc1cddab Use more natural class_weight="auto" heuristic 2015-06-01 12:49:53 -04:00
Andreas Mueller 669a4ea853 ENH add high-level estimator-validation function 2015-04-28 16:46:13 -04:00
Andreas Mueller 932726fe9d Merge pull request #4467 from giantoak/param_invariance
[MRG + 1] BUG: get_param in FeatureUnion disjoint for shallow/deep params
2015-04-19 14:55:17 -05:00
Sam Zhang edf60c0ee2 BUG: get_param in FeatureUnion disjoint for shallow/deep params
- Previously params in a FeatureUnion or Pipeline were different
when deep=False and deep=True, making it impossible to set shallow
params during GridSearch (issue #4461)
- Added test to enforce deep=True results to be superset of deep=False.
- Updated deep get_param output in pipeline estimators with shallow params.

TST: Test estimators for get_params invariance

- Estimators that support get_params should always be consistent
in that get_params(deep=False) should be a subset of get_params(deep=True)
- Implemented test over all "normal" and "other" estimators provided by
all_estimators
- Ignoring grid_search estimators for now

TST: Amended init_pipeline test to only compare non-estimators
2015-04-03 21:33:29 +00:00
Varoquaux 6c81fbcf7b Merge pull request #4420 from amueller/cca_low_rank
FIX CCA low rank doesn't crash any more
2015-04-02 19:02:15 +02:00
Andreas Mueller d89c215013 Add tags to classifiers and regressors to identify them as such. 2015-03-31 19:59:49 -04:00
Raghav R V cd2ee7e454 MAINT docstring --> comments to prevent nose from using doc in verbose mode 2015-03-21 11:16:49 +05:30
Andreas Mueller 6bbd7c0e0e make cross_decomposition pass common tests 2015-03-19 19:09:50 -04:00
Andreas Mueller 82e44154b9 FIX Minor shape fixes in PLS 2015-03-19 19:02:09 -04:00
Olivier Grisel feceab6f62 FIX test for consistent handling on empty input data 2015-02-26 10:45:06 +01:00
Andreas Mueller cd5166e82f make check_array convert object to float.
fix dtype check, add test. unfriend all multi-output estimators on facebook.

try to fix what is happening to y (by doing nothing to y)

make test work...

Make everything accept object y or say "invalid label"

fix multioutput linear models

add test for sensible error message.
2015-02-15 12:13:41 -05:00
Andreas Mueller 8ef0b9a82f fixes in GMM, TSNE, MDS, LSHForest, exclude SpectralEmbedding 2015-02-10 18:34:31 -05:00
Andreas Mueller e3e0827243 FIX check (and enforce) that estimators can accept different dtypes. 2015-02-10 15:37:15 -05:00
Andreas Mueller cd63accc05 Add test that score takes y, fix KMeans, FIX pipeline compatibility of clustering algorithms! 2015-02-06 13:26:42 +01:00
Andreas Mueller edc9bbb5c7 remove duplicated test, probably caused by rebase issues. 2015-01-20 15:48:35 -05:00
Andreas Mueller 494b8e5743 TST add test for sparse matrix handling in clustering
Make sparsity check check everything.

don't test everything. That would be nice but is out of scope :-/

catch special case of no core samples in DBSCAN

add nonregression test for sparse dbscan with no core samples.
2015-01-16 12:03:20 -05:00
Olivier Grisel c1f3080e1d Merge pull request #4058 from amueller/cleanup_common_tests
[MRG+1] slight cleanup of common tests.
2015-01-15 11:14:07 +01:00
Raghav R V 0fce60d285 TST Add tests to assert if NotFittedError is raised appropriately 2015-01-12 00:33:40 +05:30
Andreas Mueller 16662744ac TST slight cleanup of common tests. 2015-01-11 13:54:29 -05:00
Lars Buitinck 40c03d4880 COSMIT pep8 fixes to sklearn/tests 2014-12-18 16:40:01 +01:00