sktime/sktime

[ENH] Refactor multiplication of classifier tests

Open

#2,255 建立於 2022年3月19日

在 GitHub 查看
 (8 留言) (0 反應) (0 負責人)Python (1,192 fork)batch import
enhancementgood first issuemodule:classificationmodule:testsrefactor

倉庫指標

Star
 (7,162 star)
PR 合併指標
 (平均合併 26天 10小時) (30 天內合併 86 個 PR)

描述

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:

  1. find the file test_[classifier] or similar, containing tests test_[classifier]_on_unit_test_data and possibly test_[classifier]_on_basic_motions or similar.
  2. 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 with tests/_config, if there are still parameters there, also move them to get_test_params)
  3. add the "expected outputs" from the test_[classifier] file to classification/tests/_expected_outputs (follow the pattern)
  4. delete the file test_[classifier]
  5. 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

貢獻者指南