You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[MRG + 1] Move n_iter and get_params invariance tests to common estimator_checks (scikit-learn#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 scikit-learn#7533
Also related to issue scikit-learn#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 scikit-learn#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 scikit-learn#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 scikit-learn#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_
0 commit comments