-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Duplicate method calls in estimator checks #17149
Copy link
Copy link
Closed
Labels
Description
Is there a reason why we generate results twice on the estimator? Once in L1480 and once in L1491.
scikit-learn/sklearn/utils/estimator_checks.py
Lines 1480 to 1498 in 95d4f08
| result = dict() | |
| for method in check_methods: | |
| if hasattr(estimator, method): | |
| result[method] = getattr(estimator, method)(X) | |
| # pickle and unpickle! | |
| pickled_estimator = pickle.dumps(estimator) | |
| if estimator.__module__.startswith('sklearn.'): | |
| assert b"version" in pickled_estimator | |
| unpickled_estimator = pickle.loads(pickled_estimator) | |
| result = dict() | |
| for method in check_methods: | |
| if hasattr(estimator, method): | |
| result[method] = getattr(estimator, method)(X) | |
| for method in result: | |
| unpickled_result = getattr(unpickled_estimator, method)(X) | |
| assert_allclose_dense_sparse(result[method], unpickled_result) |
Happy to create a PR to remove the lines which generate the results again after pickling if that's a duplication.
Reactions are currently unavailable