Repository navigation
MAINT More test runtime optimizations - #14136
Conversation
rth
left a comment
There was a problem hiding this comment.
A few explanations below.
The methodology was to measure runtime with pytest module --duration=10 and modify tests that were the slowest. All the changes here are those that have a measurable impact on runtime.
| X = random_state.randn(50, 2) | ||
| tsne = TSNE(n_components=2, perplexity=2, learning_rate=100.0, | ||
| random_state=0, method=method, verbose=0, n_iter=1003) | ||
| random_state=0, method=method, verbose=0, n_iter=503) |
There was a problem hiding this comment.
We just want to be sure that tsne.kl_divergence_ is computed when n_iter % n_iter_check != 0 cf comment in the code above.
| assert_almost_equal(mcc, 0.) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize('n_points', [100, 10000, 1000000]) |
There was a problem hiding this comment.
The last case was taking 6s on my laptop, which is too much for a test, and doesn't seem to add much compared to the other two.
| for scoring in (('accuracy', 'recall'), 'accuracy', 'recall'): | ||
| # If True, for multi-metric pass refit='accuracy' | ||
| if refit: | ||
| probability = True |
There was a problem hiding this comment.
predict_proba is only used below when refit=True
| assert_warns_message(RuntimeWarning, warning_message, | ||
| cross_val_predict, LogisticRegression(), | ||
| cross_val_predict, | ||
| LogisticRegression(solver="liblinear"), |
There was a problem hiding this comment.
liblinear converges faster than lbfgs here
adrinjalali
left a comment
There was a problem hiding this comment.
LGTM, let's see if it breaks the cron jobs :P
* Feature extraction / feature selection * Metrics, manifold, impute, GP optimization * Optimize mixture * Optimize model_selection * Fix tests * Lint
Optimizes the test runtime of a few more modules.
For the changed modules, this PR reduces the runtime by 40% (or 30s),