etna.analysis.distribution_plot#

distribution_plot(ts: TSDataset, n_segments: int = 10, segments: List[str] | None = None, shift: int = 30, window: int = 30, freq: str | int | None = None, n_rows: int = 10, figsize: Tuple[int, int] = (10, 5))[source]#

Distribution of z-values grouped by segments and time frequency.

Mean is calculated by the windows:

\[mean_{i} = \sum_{j=i-\text{shift}}^{i-\text{shift}+\text{window}} \frac{x_{j}}{\text{window}}\]

The same is applied to standard deviation.

Parameters:
  • ts (TSDataset) – dataset with timeseries data

  • n_segments (int) – number of random segments to plot

  • segments (List[str] | None) – segments to plot

  • shift (int) – number of timeseries shifts for statistics calc

  • window (int) – number of points for statistics calc

  • freq (str | int | None) –

    how z-values should be grouped:

    • frequency string for data with datetime timestamp, groups are formed by a given frequency, default value is “1M”

    • integer for data with integer timestamp, groups are formed by timestamp // freq, default value is ts.index.max() + 1

  • n_rows (int) – maximum number of rows to plot

  • figsize (Tuple[int, int]) – size of the figure per subplot with one segment in inches