-
Notifications
You must be signed in to change notification settings - Fork 230
[ENH] Add MechaClassifier: Multiview Enhanced Characteristics for TSC #3113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thank you for contributing to
|
|
The CI pipeline is currently showing a failure (PR pytest / pytest (windows-2022, 3.10, true) (pull_request)) that is external to my code: |
|
I will experiment to see if the accuracy of your AEON implementation version is at the same level as the accuracy in the original paper. |
|
I recommend that you use the basic feature extractor as a configurable parameter. Users can freely switch between using Catch22 or TSFresh.Catch22 and TSFresh can both directly use the functions in aeon. |
…d switching tsfresh to efficiency mode
|
@CCHe64, I have corrected bidirect_interleaving_mapping function, and have changed TSFresh to "efficient" and have run the following script: import numpy as np
from aeon.classification.feature_based import MechaClassifier
from aeon.datasets import load_arrow_head
from aeon.transformations.collection.feature_based._mecha_feature_extractor import bidirect_dilation_mapping, bidirect_interleaving_mapping
trainSeriesX, trainY = load_arrow_head("TRAIN")
testSeriesX, testY = load_arrow_head("TEST")
trainY, testY = trainY.astype(int), testY.astype(int)
# 2. Classification
mecha = MechaClassifier(random_state=0, basic_extractor="TSFresh")
mecha.fit(trainSeriesX, trainY)
testPY = mecha.predict(testSeriesX)
# 3. Result
accV = np.sum(testPY==testY) / len(testY)
print("Accuracy :", accV)
seriesX = np.zeros((5, 1, 20))
indexList0 = bidirect_dilation_mapping(seriesX)
indexList1 = bidirect_interleaving_mapping(seriesX)
print('Bidirectional Dilation Mapping')
print(indexList0)
print('Bidirectional Interleaving Mapping')
print(indexList1)And I was able to only get an accuracy of 84%. I have also given the output for you to verify the working of bidirect_interleaving_mapping. |
|
I will run the accuracy on other UCR datasets. In addition, I recommend using the same settings as in the original paper: default to TSFresh instead of Catch22 |
|
In the original paper, 85.7% on the ArrowHead dataset were obtained using TSFresh |
|
I am sorry, the previous test was ran on "Catch22". Now I have updated it with "TSFresh". But still I can only achieve 84% accuracy. Can you try it once? |
This 85.7% value is the average of 10 different random seeds. You can check the average of 10 times. |
|
I was able to achieve 84.57% when using TSFresh in 'comprehensive' mode. I will try running it in 'efficient' mode with 10 random seeds |
|
@CCHe64, When ran with 10 random seeds with the following code import numpy as np
from aeon.classification.feature_based import MechaClassifier
from aeon.datasets import load_arrow_head
trainSeriesX, trainY = load_arrow_head("TRAIN")
testSeriesX, testY = load_arrow_head("TEST")
trainY, testY = trainY.astype(int), testY.astype(int)
accuracy_scores = []
num_runs = 10
print(f"Starting classification for {num_runs} random seeds...")
for i in range(num_runs):
seed = np.random.randint(0, 10000)
mecha = MechaClassifier(random_state=seed, basic_extractor="TSFresh")
mecha.fit(trainSeriesX, trainY)
testPY = mecha.predict(testSeriesX)
accV = np.sum(testPY == testY) / len(testY)
accuracy_scores.append(accV)
print(f" Accuracy for seed {seed}: {accV:.4f}")
average_accuracy = np.mean(accuracy_scores)
std_dev_accuracy = np.std(accuracy_scores)
print("\n---")
print(f"Number of runs: **{num_runs}**")
print(f"Individual Accuracies: {np.array(accuracy_scores)}")
print(f"Average Accuracy: **{average_accuracy:.4f}**")
print(f"Standard Deviation: **{std_dev_accuracy:.4f}**")
print("---")I was able to achieve 85.71% accuracy for one of the seeds |
This is within an acceptable range. I will run the current version 10 times on 112 datasets to check the accuracy. This is time-consuming and will take about one or two days. |
|
@CCHe64, Make sure you specify |
ok |




Reference Issues/PRs
Fixes #2930
What does this implement/fix? Explain your changes.
This PR implements the Multiview Enhanced Characteristics (Mecha) Classifier in
aeon.classification.feature_based, based on the recently accepted paper "Mecha: Multiview Enhanced Characteristics via Series Shuffling for Time Series Classification and Its Application to Turntable Circuit".Mecha is an upgraded, feature-based Time Series Classification (TSC) algorithm that enhances diversity and expressiveness through three main components:
This PR includes:
MechaClassifierinaeon.classification.feature_based.series_transform,dilated_fres_extract,interleaved_fres_extract,hard_voting,_adaptive_saving_features,_gwo,_objective_function) inaeon.transformations.collection.feature_based._mecha_feature_extractor.py(and the necessary imports in__init__.py).Mecha is a feature-based ensemble that significantly upgrades the concepts introduced in TD-MVDC..
Does your contribution introduce a new dependency? If yes, which one?
No
Any other comments?
Reference:
[1] Changchun He, Xin Huo, Baohan Mi, and Songlin Chen. "Mecha: Multiview Enhanced Characteristics via Series Shuffling for Time Series Classification and Its Application to Turntable circuit", IEEE Transactions on Circuits and Systems I: Regular Papers, 2025.
PR checklist
For all contributions
For new estimators and functions
__maintainer__at the top of relevant files and want to be contacted regarding its maintenance. Unmaintained files may be removed. This is for the full file, and you should not add yourself if you are just making minor changes or do not want to help maintain its contents.For developers with write access