Change point detection in Python with ruptures Digital French-German - - PowerPoint PPT Presentation

change point detection in python with ruptures
SMART_READER_LITE
LIVE PREVIEW

Change point detection in Python with ruptures Digital French-German - - PowerPoint PPT Presentation

Change point detection in Python with ruptures Digital French-German Summer School with Industry 2020 Charles Truong 1 1Centre Borelli Universit Paris-Saclay ENS Paris-Saclay, CNRS Wednesday 24 th June Introduction Change point detection


slide-1
SLIDE 1

Change point detection in Python with ruptures

Digital French-German Summer School with Industry 2020 Charles Truong1

1Centre Borelli Université Paris-Saclay ENS Paris-Saclay, CNRS

Wednesday 24th June

slide-2
SLIDE 2

1/12

Introduction

◮ Change point detection is a common task when dealing with non-stationary time series. ◮ Application example: automatic diagnosis of neurologically impaired patients [Truong et al., 2019a]. Healthy and pathological subjects underwent a fixed protocol:

  • standing still,
  • walking 10m,
  • turning around,
  • walking back,
  • standing still.

Protocol schema Angular velocity (lower back sensor, sampling 100 Hz)

◮ Can also be applied to finance, industrial monitoring, public health monitoring, etc. [Truong et al., 2020].

slide-3
SLIDE 3

1/12

Introduction

◮ Change point detection is a common task when dealing with non-stationary time series. ◮ Application example: automatic diagnosis of neurologically impaired patients [Truong et al., 2019a]. Healthy and pathological subjects underwent a fixed protocol:

  • standing still,
  • walking 10m,
  • turning around,
  • walking back,
  • standing still.

Protocol schema Angular velocity (lower back sensor, sampling 100 Hz)

◮ Can also be applied to finance, industrial monitoring, public health monitoring, etc. [Truong et al., 2020].

slide-4
SLIDE 4

1/12

Introduction

◮ Change point detection is a common task when dealing with non-stationary time series. ◮ Application example: automatic diagnosis of neurologically impaired patients [Truong et al., 2019a]. Healthy and pathological subjects underwent a fixed protocol:

  • standing still,
  • walking 10m,
  • turning around,
  • walking back,
  • standing still.

Protocol schema Angular velocity (lower back sensor, sampling 100 Hz)

◮ Can also be applied to finance, industrial monitoring, public health monitoring, etc. [Truong et al., 2020].

slide-5
SLIDE 5

1/12

Introduction

◮ Change point detection is a common task when dealing with non-stationary time series. ◮ Application example: automatic diagnosis of neurologically impaired patients [Truong et al., 2019a]. Healthy and pathological subjects underwent a fixed protocol:

  • standing still,
  • walking 10m,
  • turning around,
  • walking back,
  • standing still.

Protocol schema Angular velocity (lower back sensor, sampling 100 Hz)

◮ Can also be applied to finance, industrial monitoring, public health monitoring, etc. [Truong et al., 2020].

slide-6
SLIDE 6

1/12

Introduction

◮ Change point detection is a common task when dealing with non-stationary time series. ◮ Application example: automatic diagnosis of neurologically impaired patients [Truong et al., 2019a]. Healthy and pathological subjects underwent a fixed protocol:

  • standing still,
  • walking 10m,
  • turning around,
  • walking back,
  • standing still.

Protocol schema Angular velocity (lower back sensor, sampling 100 Hz)

◮ Can also be applied to finance, industrial monitoring, public health monitoring, etc. [Truong et al., 2020].

slide-7
SLIDE 7

1/12

Introduction

◮ Change point detection is a common task when dealing with non-stationary time series. ◮ Application example: automatic diagnosis of neurologically impaired patients [Truong et al., 2019a]. Healthy and pathological subjects underwent a fixed protocol:

  • standing still,
  • walking 10m,
  • turning around,
  • walking back,
  • standing still.

Protocol schema Angular velocity (lower back sensor, sampling 100 Hz)

◮ Can also be applied to finance, industrial monitoring, public health monitoring, etc. [Truong et al., 2020].

slide-8
SLIDE 8

2/12

What is change point detection?

◮ Change point detection consists in finding the temporal boundaries between homogeneous time periods. ◮ Informally: “multivariate signal − → list of change point indexes”

x y z 8.139 8.337

  • 21.055

6.964 9.881

  • 20.693

4.317 9.993

  • 19.309

1.752 8.950

  • 16.941
  • 0.305

7.356

  • 13.143
  • 2.320

7.384

  • 7.361
  • 3.312

8.467

  • 2.530
  • 3.697

10.891 2.523

  • 2.622

13.363 5.863

  • 2.728

11.761 4.473

[t1, t2, t3, …]

slide-9
SLIDE 9

2/12

What is change point detection?

◮ Change point detection consists in finding the temporal boundaries between homogeneous time periods. ◮ Informally: “multivariate signal − → list of change point indexes”

x y z 8.139 8.337

  • 21.055

6.964 9.881

  • 20.693

4.317 9.993

  • 19.309

1.752 8.950

  • 16.941
  • 0.305

7.356

  • 13.143
  • 2.320

7.384

  • 7.361
  • 3.312

8.467

  • 2.530
  • 3.697

10.891 2.523

  • 2.622

13.363 5.863

  • 2.728

11.761 4.473

[t1, t2, t3, …]

slide-10
SLIDE 10

3/12

ruptures: a Python library

Github page (github.com/deepcharles/ruptures) Documentation Associated publication [Truong et al., 2020] How to install

Links and information on the Github page.

slide-11
SLIDE 11

3/12

Table of contents

  • 1. Introduction
  • 2. What is change point detection?
  • 3. General principle of ruptures
  • 4. ruptures in action

A simple example Gait analysis

  • 5. Supervised change point detection

General principle Deep detection

  • 6. Conclusion
slide-12
SLIDE 12

4/12

General principle

ruptures: a Python library

How to choose a segmentation?

= {t1, t2, t3} V( ) = c(y0. . t1) + c(yt1. . t2) + c(yt2. . t3) + c(yt3. . T)

The “best segmentation” is the minimizer, denoted T ,

  • f a criterion V(T ):

V(T ) :=

K

  • k=0

c(ytk..tk+1). Cost example: c(y) =

t(yt − ¯

y)2. Problem 1. Fixed number K of change points:

  • T := arg min

T

V(T ) s.t. |T | = K. Problem 2. Unknown number of change points:

  • T := arg min

T

V(T ) + pen(T ) where pen(T ) measures the complexity of a segmen- tation T .

slide-13
SLIDE 13

5/12

General principle

ruptures: a Python library

Detection methods are the combination of three elements [Truong et al., 2020]. Cost function Search method Constraint Criterion V(T ) to minimize: V(T ) :=

K

  • k=0

c(ytk..tk+1) . Problem 1. Fixed number K of change points:

  • T := arg min

T

V(T ) s.t. |T | = K . Problem 2. Unknown number of change points:

  • T := arg min

T

V(T ) + pen(T ) where pen(T ) measures the complexity of a segmen- tation T .

slide-14
SLIDE 14

6/12

General principle

ruptures: a Python library

◮ A modular architecture.

First import and data loading. Choosing the cost function . Here, c(y) =

t(yt − ¯

y)2. Choosing the search method . Here, binary segmentation. Fiting the algorithm. Choosing the constraint . Then detecting the change points (“predict”). Measuring the detection accuracy.

slide-15
SLIDE 15

6/12

Table of contents

  • 1. Introduction
  • 2. What is change point detection?
  • 3. General principle of ruptures
  • 4. ruptures in action

A simple example Gait analysis

  • 5. Supervised change point detection

General principle Deep detection

  • 6. Conclusion
slide-16
SLIDE 16

7/12

A simple example

ruptures in action

Import and generate signal Choose a method and detect change points Measure accurary

slide-17
SLIDE 17

8/12

Gait analysis

ruptures in action

◮ To simplify the detection task, the signal is transformed (here, short-term Fourier transform). ◮ Then mean-shifs are detected.

Angular velocity (lower back sensor, sampling 100 Hz) Signal transformation

slide-18
SLIDE 18

8/12

Gait analysis

ruptures in action

◮ To simplify the detection task, the signal is transformed (here, short-term Fourier transform). ◮ Then mean-shifs are detected.

Angular velocity (lower back sensor, sampling 100 Hz) Signal transformation

slide-19
SLIDE 19

8/12

Table of contents

  • 1. Introduction
  • 2. What is change point detection?
  • 3. General principle of ruptures
  • 4. ruptures in action

A simple example Gait analysis

  • 5. Supervised change point detection

General principle Deep detection

  • 6. Conclusion
slide-20
SLIDE 20

9/12

Supervised change point detection

General principle

◮ How to integrate expert knowledge to calibrate the change point detection? [Truong et al., 2019b] The expert provides the target segmentation: either full or partial label.

Full label The exact change point locations are provided. Partial label Only homogeneous periods (hatched areas) are provided (weakly super- vised).

Labels are transformed into constraints. Intuitively, the problem is: ◮ Learn a transformation Ψ such that d(Ψ(xt), Ψ(xs)) ≤ u if xt and xs similar d(Ψ(xt), Ψ(xs)) ≥ l if xt and xs dissimilar (u > 0 and l > 0) Two samples are similar if they belong to the same regime. Two samples are dissimilar if they belong to consecu- tive regimes.

slide-21
SLIDE 21

10/12

Deep change point detection

Supervised change point detection

This seting can be used to learn a deep representation.

Here, two layers of temporal separable convolutions and max- pooling (with tensorflow). Learning phase Prediction phase Epoch by epoch (epoch 0)

500 1000 1500 2000 0.4 0.2 0.0 0.2

Max error: 9.08 sec (epoch 0)

True segmentation: alternating colors. Predicted segmentation: dashed lines.

slide-22
SLIDE 22

10/12

Deep change point detection

Supervised change point detection

This seting can be used to learn a deep representation.

Here, two layers of temporal separable convolutions and max- pooling (with tensorflow). Learning phase Prediction phase Epoch by epoch (epoch 10)

500 1000 1500 2000 0.08 0.06 0.04 0.02 0.00 0.02

Max error: 6.80 sec (epoch 10)

True segmentation: alternating colors. Predicted segmentation: dashed lines.

slide-23
SLIDE 23

10/12

Deep change point detection

Supervised change point detection

This seting can be used to learn a deep representation.

Here, two layers of temporal separable convolutions and max- pooling (with tensorflow). Learning phase Prediction phase Epoch by epoch (epoch 20)

500 1000 1500 2000 0.08 0.07 0.06 0.05 0.04

Max error: 5.85 sec (epoch 20)

True segmentation: alternating colors. Predicted segmentation: dashed lines.

slide-24
SLIDE 24

10/12

Deep change point detection

Supervised change point detection

This seting can be used to learn a deep representation.

Here, two layers of temporal separable convolutions and max- pooling (with tensorflow). Learning phase Prediction phase Epoch by epoch (epoch 30)

500 1000 1500 2000 0.070 0.065 0.060 0.055 0.050 0.045

Max error: 7.55 sec (epoch 30)

True segmentation: alternating colors. Predicted segmentation: dashed lines.

slide-25
SLIDE 25

10/12

Deep change point detection

Supervised change point detection

This seting can be used to learn a deep representation.

Here, two layers of temporal separable convolutions and max- pooling (with tensorflow). Learning phase Prediction phase Epoch by epoch (epoch 40)

500 1000 1500 2000 0.025 0.020 0.015 0.010 0.005

Max error: 0.33 sec (epoch 40)

True segmentation: alternating colors. Predicted segmentation: dashed lines.

slide-26
SLIDE 26

10/12

Deep change point detection

Supervised change point detection

This seting can be used to learn a deep representation.

Here, two layers of temporal separable convolutions and max- pooling (with tensorflow). Learning phase Prediction phase Epoch by epoch (epoch 50)

500 1000 1500 2000 0.0150 0.0175 0.0200 0.0225 0.0250 0.0275 0.0300

Max error: 0.28 sec (epoch 50)

True segmentation: alternating colors. Predicted segmentation: dashed lines.

slide-27
SLIDE 27

10/12

Deep change point detection

Supervised change point detection

This seting can be used to learn a deep representation.

Here, two layers of temporal separable convolutions and max- pooling (with tensorflow). Learning phase Prediction phase Epoch by epoch (epoch 60)

500 1000 1500 2000 0.0125 0.0150 0.0175 0.0200 0.0225

Max error: 0.32 sec (epoch 60)

True segmentation: alternating colors. Predicted segmentation: dashed lines.

slide-28
SLIDE 28

10/12

Deep change point detection

Supervised change point detection

This seting can be used to learn a deep representation.

Here, two layers of temporal separable convolutions and max- pooling (with tensorflow). Learning phase Prediction phase Epoch by epoch (epoch 80)

500 1000 1500 2000 0.0125 0.0100 0.0075 0.0050 0.0025 0.0000

Max error: 0.33 sec (epoch 80)

True segmentation: alternating colors. Predicted segmentation: dashed lines.

slide-29
SLIDE 29

10/12

Deep change point detection

Supervised change point detection

This seting can be used to learn a deep representation.

Here, two layers of temporal separable convolutions and max- pooling (with tensorflow). Learning phase Prediction phase Epoch by epoch (epoch 90)

500 1000 1500 2000 0.020 0.015 0.010 0.005 0.000

Max error: 0.33 sec (epoch 90)

True segmentation: alternating colors. Predicted segmentation: dashed lines.

slide-30
SLIDE 30

10/12

Deep change point detection

Supervised change point detection

This seting can be used to learn a deep representation.

Here, two layers of temporal separable convolutions and max- pooling (with tensorflow). Learning phase Prediction phase Epoch by epoch (epoch 100)

500 1000 1500 2000 0.010 0.005 0.000 0.005

Max error: 0.33 sec (epoch 100)

True segmentation: alternating colors. Predicted segmentation: dashed lines.

slide-31
SLIDE 31

11/12

Conclusion

◮ Code for those experiments will be available on my GitHub github.com/deepcharles. ◮ Data set is already published [Truong et al., 2019a]. ◮ New methods are frequently implemented in ruptures. ◮ Extensions to graph/network data soon.

slide-32
SLIDE 32

12/12

References

Truong, C., Barrois-Müller, R., Moreau, T., Provost, C., Vienne-Jumeau, A., Moreau, A., Vidal, P.-P., Vayatis, N., Buffat, S., Yelnik, A., Ricard, D., and Oudre, L. (2019a). A data set for the study of human locomotion with inertial measurements units. Image Processing On Line, 9. Truong, C., Oudre, L., and Vayatis, N. (2019b). Supervised kernel change point detection with partial annotations. In Proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 1–5, Brighton, UK. Truong, C., Oudre, L., and Vayatis, N. (2020). Selective review of offline change point detection methods. Signal Processing, 167.