Skip to content

Piecewise 2D Gaussian process (pw_normal)#

Description#

The function pw_normal simulates a 2D signal of Gaussian i.i.d. random variables with zero mean and covariance matrix alternating between \([[1, 0.9], [0.9, 1]]\) and \([[1, -0.9], [-0.9, 1]]\) at every change point.

Top and middle: 2D signal example. Bottom: Scatter plot for each regime type

Usage#

Start with the usual imports and create a signal.

import numpy as np
import matplotlib.pylab as plt
import ruptures as rpt

# creation of data
n = 500, 3  # number of samples
n_bkps = 3  # number of change points, noise standart deviation
signal, bkps = rpt.pw_normal(n, n_bkps)
rpt.display(signal, bkps)