enhancementgood first issuemodule:classificationmodule:testsrefactor
Repository metrics
- Stars
- (7,162 stars)
- PR merge metrics
- (Avg merge 26d 10h) (86 merged PRs in 30d)
Description
Looking through the tests, I found that every classifier has a test file, and in it there is test_[classifiername]_on_unit_test_data and test_[classifiername]_on_basic_motions, with hundreds of lines of copy/paste. This is highly redundant and should be moved to a single file, using pytest.mark.parametrize and all_estimators.
#2257 makes a start how this could look like in the context of a classifier test suite refactor. I would suggest to branch off #2257 and follow the pattern. (assumes #2257 is merged. Until then, branch off #2257)
The recipe is as follows, for a given classifier:
- find the file
test_[classifier]or similar, containing teststest_[classifier]_on_unit_test_dataand possiblytest_[classifier]_on_basic_motionsor similar. - move the parameter settings for the classifier into
get_test_params, of the classifier class. Ensure it is the first element of the list returned. (also ensure there is no duplication withtests/_config, if there are still parameters there, also move them toget_test_params) - add the "expected outputs" from the
test_[classifier]file toclassification/tests/_expected_outputs(follow the pattern) - delete the file
test_[classifier] - ensure the unit tests pass. They should, if this has been done 1:1
Classifiers to refactor:
- cboss
- muse
- tde
- weasel
- elastic_ensemble
- shape_dtw
- time_series_neighbors
- probability_threshold
- teaser
- catch22_classifier
- fresh_prince
- matrix_profile_classifier
- random_interval_classifier
- signature_classifier
- summary_classifier
- tsfresh_classifier
- hivecote_v1
- hivecote_v2
- cif
- dtc
- drcif
- rise
- stsf
- tsf
- arsenal
- rocket_classifier
- stc