plotFPOP Vignette

Vincent Runge

LaMME Université d'Evry. October 22, 2017

Introduction

Data simulation

Plots

Introduction

plotFPOP is a package providing plotting functions for dynamic programming changepoint algorithms with penalty using functional pruning. The package provides simple (written in R) functions and algorithms to plot the functional cost in 1d and 2d at consecutive times. The goal is to give an easy and simple access to the shape of the functional cost in order to better understand its updates. The package also contains simulation functions to generate segmented data under a gaussian law in dimension 1 and 2.

This vignette describes the usage of plotFPOP in R.

First, let us install the package:

#install.packages("plotFPOP")

and load it:

library(plotFPOP)

Data simulation

We simulate 1d data with the function dataG1

dataG1(mean = c(0.5,1), tau = c(0.3,1), n= 20)

This function has two vector arguments : 'mean' to specify the consecutive means on each segment, 'tau' for the relative positions of the last point on each segment. The segmentation is based on gaussian laws with a unique standard deviation 'sigma'. 'n' is the number of data to simulate.

We simulate 2d data with the function dataG1

dataG2(mean1 = c(0.5,1), mean2 = c(0,0.5), tau = c(0.3,1), n= 20)

With this function, a segmentation in dimension 2 is simulated. Two vectors of means has to be given : 'mean1' and 'mean2'. The other arguments are the same as for dataG1. The obtained segmentation is also based on gaussian distribution with a constant standard deviation.

Plots

data <- dataG1(sigma = 0.5, n=5)
fpop1d(data,1)

This function 'fpop1d' returns consecutive plots and consecutive vectors containing the indexes of present labels for data in dimension 1. The argument 'beta' is a positive number: the penalty to use in this penalized version of the dynamic programming algorithm. The last argument 'order' is a boolean, if true, the vector of labels gives the labels arising from left to right in the functional cost.

data <- dataG2(mean1 = 0, mean2 = 0, tau = 1, sigma = 0.5, n=5)
fpop2d(data, nb = 300, 1, circle = TRUE)

This function 'fpop2d' shows the shape of the functional cost in dimension 2 at level 'minimum of this function' + beta. Each color represents a different label. Argument 'precision' is used to force the size of the matrix to plot. The boolean 'circle', if set to true, is used to display the circles of intersection at each time step.

Back to Top



vrunge/plotFPOP documentation built on May 29, 2019, 9:57 a.m.