ShapeletVisualizer¶
- class ShapeletVisualizer(values, normalise=False, dilation=1, threshold=None, length=None)[source]¶
Bases:
objectA Shapelet object to use for plotting operations.
- Parameters:
- valuesarray, shape=(n_channels, length)
Values of the shapelet.
- normalisebool
Whether the shapelet use a normalised distance.
- dilationint
Dilation of the shapelet. The default is 1, which is equivalent to no dilation.
- thresholdfloat
Lambda threshold for Shapelet Occurrence feature. The default value is None if it is not used (used in RDST).
- lengthint
Length of the shapelet. The default values is None, meaning length is inferred from the values array. Otherwise, the values array 2nd axis will be set to this length.
Methods
plot([ax, scatter_options, line_options, ...])Plot the shapelet values.
plot_distance_vector(X[, ax, show_legend, ...])Plot the shapelet distance vector computed between itself and X.
plot_on_X(X[, ax, scatter_options, ...])Plot the shapelet on its best match on the time series X.
- plot(ax=None, scatter_options={'alpha': 0.75, 'edgecolor': 'black', 'linewidths': 2, 's': 70, 'zorder': 3}, line_options={'alpha': 0.9, 'linestyle': '--', 'linewidth': 2}, figure_options={'dpi': 100, 'figsize': (10, 5)}, rc_Params_options={'font.size': 22}, matplotlib_style='seaborn-v0_8', custom_title_string=None)[source]¶
Plot the shapelet values.
- Parameters:
- axmatplotlib axe
A matplotlib axe on which to plot the figure. The default is None and will create a new figure of size figsize.
- line_optionsdict
Options to apply to plot of the shapelet values.
- scatter_optionsdict
Options to apply to scatter plot of the shapelet values.
- figure_optionsdict
Dictionary of options passed to plt.figure. Only used if ax is None.
- rc_Params_options: dict
Dictionary of options passed to plt.rcParams.update. Only used if ax is None.
- matplotlib_style: str
Matplotlib style to be used. Only used if ax is None.
- custom_title_stringstr
If not None, use this string as title for the plot instead of the default one based on the shapelet parameters.
- Returns:
- figmatplotlib figure
The resulting figure
- plot_distance_vector(X, ax=None, show_legend=True, show_threshold=True, line_options={'alpha': 0.9, 'linewidth': 2}, threshold_options={'alpha': 0.9, 'color': 'purple', 'label': 'threshold', 'linewidth': 2}, figure_options={'dpi': 100, 'figsize': (10, 5)}, rc_Params_options={'font.size': 22}, matplotlib_style='seaborn-v0_8')[source]¶
Plot the shapelet distance vector computed between itself and X.
- Parameters:
- Xarray, shape=(n_features, n_timestamps)
Input time series
- axmatplotlib axe
A matplotlib axe on which to plot the figure. The default is None and will create a new figure of size figsize.
- show_legendbool, optional
Whether to show legend. Default is True
- show_threshold: bool, optional
Whether to show threshold (if it is not set to None). Default is True.
- threshold_optionsdict
Dictionary of options passed to the line plot of the threshold.
- line_optionsdict
Dictionary of options passed to the plot of the distance vector values.
- figure_optionsdict
Dictionary of options passed to plt.figure. Only used if ax is None.
- rc_Params_options: dict
Dictionary of options passed to plt.rcParams.update. Only used if ax is None.
- matplotlib_style: str
Matplotlib style to be used. Only used if ax is None.
- Returns:
- figmatplotlib figure
The resulting figure with the distance vector obtained by d(S,X)
- plot_on_X(X, ax=None, scatter_options={'alpha': 0.75, 'c': 'purple', 's': 40, 'zorder': 1}, line_options={'alpha': 0.9, 'linewidth': 2}, figure_options={'dpi': 100, 'figsize': (10, 5)}, rc_Params_options={'font.size': 22}, matplotlib_style='seaborn-v0_8')[source]¶
Plot the shapelet on its best match on the time series X.
- Parameters:
- Xarray, shape=(n_features, n_timestamps)
Input time series
- axmatplotlib axe
A matplotlib axe on which to plot the figure. The default is None and will create a new figure of size figsize.
- scatter_optionsdict
Dictionary of options passed to the scatter plot of the shapelet values.
- line_optionsdict
Dictionary of options passed to the plot of the time series values.
- figure_optionsdict
Dictionary of options passed to plt.figure. Only used if ax is None.
- rc_Params_options: dict
Dictionary of options passed to plt.rcParams.update. Only used if ax is None.
- matplotlib_style: str
Matplotlib style to be used. Only used if ax is None.
- Returns:
- figmatplotlib figure
The resulting figure with S on its best match on X. A normalised shapelet will be scaled to match the scale of X.