Thanks to visit codestin.com
Credit goes to github.com

Skip to content

test: speed up two slow tests - #34269

Merged
ogrisel merged 1 commit into
scikit-learn:mainfrom
rth:test/speed-up-slow-tests
Jun 12, 2026
Merged

test: speed up two slow tests#34269
ogrisel merged 1 commit into
scikit-learn:mainfrom
rth:test/speed-up-slow-tests

Conversation

@rth

@rth rth commented Jun 12, 2026

Copy link
Copy Markdown
Member

A tiny fix to speed up the 2 slowest tests in CI:

before

  17.46s call     sklearn/tests/test_calibration.py::test_calibrated_classifier_cv_works_with_large_confidence_scores[3]
  1.72s call     sklearn/model_selection/tests/test_validation.py::test_cross_validate_params_none[permutation_test_score-extra_args4]

after

  0.62s call     sklearn/tests/test_calibration.py::test_calibrated_classifier_cv_works_with_large_confidence_scores[3]
  0.13s call     sklearn/model_selection/tests/test_validation.py::test_cross_validate_params_none[learning_curve-extra_args3]

So gains 18s on a 11min test suite run (maybe a bit more in CI). Small but non negligible.

- test_calibrated_classifier_cv_works_with_large_confidence_scores: reduce
  n from 1000 to 200. The SGDClassifier never converges on the deliberately
  unscaled data, so the per-fit cost scales with n. A few hundred samples
  still reproduce the large confidence scores from issue 26766 across all
  seeds, dropping the worst-seed runtime from ~18s to ~1s.
- test_cross_validate_params_none: run permutation_test_score with
  n_permutations=5 instead of the default 100; the test only exercises the
  params=None code path, so the permutation count is irrelevant.
"""
prob = 0.67
n = 1000
n = 200

@rth rth Jun 12, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that this still works as a non regression test for the issue linked in the docstring.

@ogrisel
ogrisel enabled auto-merge (squash) June 12, 2026 14:18
@ogrisel
ogrisel merged commit 88080a5 into scikit-learn:main Jun 12, 2026
45 of 46 checks passed
@rth
rth deleted the test/speed-up-slow-tests branch July 20, 2026 19:27
prady0t pushed a commit to prady0t/scikit-learn that referenced this pull request Sep 2, 2026
@jeremiedbb jeremiedbb mentioned this pull request Sep 8, 2026
14 tasks
jeremiedbb pushed a commit that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants