plot_windows#
- plot_windows(cv, y, title='', ax=None)[source]#
Plot training and test windows.
Plots the training and test windows for each split of a time series, subject to an sktime time series splitter.
x-axis: time, ranging from start to end of
y
y-axis: window number, starting at 0
plot elements: training split (orange) and test split (blue)
dots indicate index in the training or test split will be plotted on top of each other if train/test split is not disjoint
- Parameters:
- ypd.Series
Time series to split
- cvsktime splitter object, descendant of BaseSplitter
Time series splitter, e.g., temporal cross-validation iterator
- titlestr
Plot title
- axmatplotlib.axes.Axes, optional (default=None)
Axes on which to plot. If None, axes will be created and returned.
- Returns:
- figmatplotlib.figure.Figure, returned only if ax is None
matplotlib figure object
- axmatplotlib.axes.Axes
matplotlib axes object with the figure
Examples
>>> from sktime.split import ExpandingWindowSplitter >>> from sktime.utils.plotting import plot_windows >>> from sktime.datasets import load_airline >>> import numpy as np
>>> fh = np.arange(1, 13) >>> cv = ExpandingWindowSplitter(step_length=1, fh=fh, initial_window=24) >>> y = load_airline() >>> plot_windows(cv, y.iloc[:50])