-
Notifications
You must be signed in to change notification settings - Fork 257
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
There are some critical issues in ShapeletClassifierVisualizer when working with multivariate time series (n_channels > 1):
- Recursion Bug in Legends: The plotting function recursively appends channel information to the label string inside a loop (e.g.,
"Label channel 0 channel 1..."), resulting in illegible legends that obscure the plot. - Broadcasting Error: The method
plot_distance_vectorfails with aValueError: operands could not be broadcast togetherfor multivariate inputs because the normalization logic does not usekeepdims=True. - Visual Clarity: The default styling for multivariate plots makes it difficult to distinguish between channels and classes (same colors used for different channels).
This issue was mentioned by @baraline during the discussion of documentation improvements here #3027 (reply in thread)
Steps/Code to reproduce the bug
import matplotlib.pyplot as plt
import numpy as np
from aeon.classification.shapelet_based import RDSTClassifier
from aeon.visualisation import ShapeletClassifierVisualizer
def test_legend_bug():
X = np.random.rand(10, 3, 30)
y = np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1])
clf = RDSTClassifier(max_shapelets=5, random_state=42)
clf.fit(X, y)
viz = ShapeletClassifierVisualizer(clf)
figs = viz.visualize_shapelets_one_class(X, y, class_id=0, n_shp=1)
output_file = "legend_test_output.png"
figs[0].savefig(output_file)
if __name__ == "__main__":
test_legend_bug()Expected results
- No Crash: The visualization should generate without a broadcasting ValueError.
- Clean Legend: The legend should display concise labels (e.g., "Class 0 channel 0") without recursive repetition.
- Clear Distinction: Multivariate plots should use distinct visual cues (e.g., color for channels, line style for classes) to be readable.
- Proper Alignment: No text overrun or overlap should be there.
Actual results
Crash: ValueError: operands could not be broadcast together with shapes...
Visuals (if crash fixed): The legend text grows exponentially with the number of channels, and lines are indistinguishable.

Versions
Details
System: python: 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] executable: C:\Users\satwi\AppData\Local\Programs\Python\Python311\python.exe machine: Windows-10-10.0.26200-SP0 Python dependencies: aeon: 1.3.0 pip: 22.3 setuptools: 65.5.0 scikit-learn: 1.7.2 numpy: 2.2.6 numba: 0.61.2 scipy: 1.15.3 pandas: 2.3.3Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working