Repository navigation
[ENH] Add prior_correction to HIVECOTEV2, default 0.5 - #3992
TonyBagnall wants to merge 2 commits into
Conversation
The CAWPE combination leans towards classes that are common in the training data. HIVECOTEV2 now divides the combined probabilities by the train class prior raised to prior_correction and renormalises. 0 gives the original combination; the base class defaults to 0, so HIVECOTEV1 is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thank you for contributing to
|
…the HC2 builder HC2 builds its DrCIF with 500 trees, but the EEG components ran the default 200, so HC2 from file now uses DrCIF-500; DrCIF stays as a standalone entry. --prior-correction applies the beta of aeon-toolkit/aeon#3992 when building.
edit: deprecated code in HC2 and increased coverage while I was here
we noted in the HC2 paper that it does relatively poorly on imbalanced data. It turns out a simple correction in the ensemble stage goes a long way to correct this. tl;dr: accuracy goes up a little (average up 0.17 on UCR and 0.48 on multiverse) balacc a lot (0.74 on UCR, 2.44 on Multiverse!)
This PR adds
prior_correctionparameter toHIVECOTEV2, default 0.5.HIVE-COTE 2's CAWPE combination leans towards the classes that are common in the training data: when the components are unsure, the weighted sum favours the majority class, and the rarer classes are under-predicted. The correction divides the combined probabilities by the train class prior raised to
prior_correctionand renormalises, before the argmax.Changes:
_BaseHIVECOTEgetsprior_correction(default 0, soHIVECOTEV1is unchanged), stores the train class proportions asclass_prior_, and combines the components in a new_combinemethod.HIVECOTEV2.predict_proba_with_componentsuses_combine, so it returns the same probabilities aspredict_proba.HIVECOTEV2defaults toprior_correction=0.5.Results. HC2 was rebuilt from the component results files with each beta.
UCR, 112 univariate datasets, 30 resamples. Changes are in percentage points against beta = 0; p is from a Wilcoxon signed-rank test over datasets.
At beta = 0.5, the change by train imbalance (largest class over smallest), as accuracy / balanced accuracy:
Two further archives that were not used to choose 0.5:
0.5 has the highest accuracy of the values tried and about two thirds of the balanced accuracy gain of full correction. Larger values start to lose accuracy on highly imbalanced data.
Does your contribution introduce a new dependency? If yes, which one?
No.
Any other comments?
HIVECOTEV2on imbalanced training data:predict_probachanges, and somepredictresults change.prior_correction=0restores the old behaviour. Should this go through a deprecation cycle (default 0 with a warning, then 0.5), or is a changed default acceptable for a minor release?HIVECOTEV2is already excluded intesting_config.py, so no stored results needed regenerating.predict_probaandpredict_proba_with_components, that balanced data is unchanged, and that negative values are rejected.check_estimatorpasses forHIVECOTEV1andHIVECOTEV2.