scikit-learn-contrib / scikit-matter

A collection of scikit-learn compatible utilities that implement methods born out of the materials science and chemistry communities
https://scikit-matter.readthedocs.io/en/v0.2.0/
BSD 3-Clause "New" or "Revised" License
76 stars 20 forks source link

Tests are running slow #174

Closed PicoCentauri closed 1 year ago

PicoCentauri commented 1 year ago

Running the unit tests locally takes a lot of time. This makes it super hard to quickly test changes to the library locally.

We should take some time and try to speed them up. This is also related to #134.

When checking the tests we can also consider reorganization as proposed in #106.

PicoCentauri commented 1 year ago

I did some benachmarking and these are the 25 slowest tests:

590.05s call     tests/test_sample_pcov_cur.py::TestPCovCUR::test_multiple_k
185.01s call     tests/test_kernel_pcovr.py::KernelPCovRTestSVDSolvers::test_svd_solvers
20.78s call     tests/test_kernel_pcovr.py::KernelPCovRErrorTest::test_reconstruction_errors
20.63s call     tests/test_kernel_pcovr.py::KernelTests::test_kernel_types
19.53s call     tests/test_kernel_pcovr.py::KernelPCovRErrorTest::test_lr_with_x_errors
9.77s call     tests/test_kernel_pcovr.py::KernelPCovRTestSVDSolvers::test_good_n_components
8.43s call     tests/test_pcovr.py::PCovRSpaceTest::test_spaces_equivalent
8.06s call     tests/test_kernel_pcovr.py::KernelPCovRErrorTest::test_kpcovr_error
7.58s setup    tests/test_datasets.py::ROYTests::test_dataset_consistency
5.97s call     tests/test_kernel_pcovr.py::KernelTests::test_linear_matches_pcovr
3.82s call     tests/test_kernel_pcovr.py::KernelPCovRInfrastructureTest::test_no_arg_predict
3.71s call     tests/test_kernel_pcovr.py::KernelPCovRInfrastructureTest::test_T_shape
2.35s call     tests/test_kernel_pcovr.py::KernelPCovRInfrastructureTest::test_precomputed_regression
2.15s call     tests/test_kernel_pcovr.py::KernelPCovRInfrastructureTest::test_none_regressor
2.08s call     tests/test_kernel_pcovr.py::KernelPCovRTestSVDSolvers::test_bad_n_components
1.56s call     tests/test_kernel_pcovr.py::KernelPCovRInfrastructureTest::test_prefit_regressor
1.37s call     tests/test_kernel_pcovr.py::KernelPCovRInfrastructureTest::test_centerer
1.12s call     tests/test_kernel_pcovr.py::KernelPCovRInfrastructureTest::test_no_centerer
0.94s call     tests/test_sample_simple_cur.py::TestCUR::test_bad_transform
0.80s call     tests/test_feature_simple_cur.py::TestCUR::test_restart
0.46s call     tests/test_pcovr.py::PCovRInfrastructureTest::test_incompatible_regressor
0.38s call     tests/test_kernel_pcovr.py::KernelPCovRTestSVDSolvers::test_bad_solver
0.38s call     tests/test_pcovr.py::PCovRErrorTest::test_against_pca
0.37s call     tests/test_kernel_pcovr.py::KernelPCovRInfrastructureTest::test_incompatible_coef_shape
0.37s call     tests/test_pcovr.py::PCovRErrorTest::test_simple_reconstruction

If we speedup the first 5 we will get a lightspeed testsuite.

PicoCentauri commented 1 year ago

Closed by #190.