exactalg: Segment data into exact change points

Description Usage Arguments Details Value

View source: R/exactalg.R

Description

Find changes points with minimal total cost comparing all possible segment combinations

Usage

1
2
exactalg(data, cost, likelihood, max_segments = ncol(data),
  allow_parallel = TRUE)

Arguments

data

matrix for which to find the change points

cost

a function receives the segment matrix as argument and returns a cost for the segment. This function is used to calculate the change points that minimize the total cost. Depending on the algorithm being used, this function is likely to be executed many times, in which case it's also likely to be the bottleneck of the function execution, so it's good for this function to have a fast implementation.

likelihood

deprecated: use cost instead. function receives the segment matrix as argument and returns a likelihood estimation. This function is used to calculate the change points that maximize the total likelihood. Depending on the algorithm being used, this function is likely to be executed many times, in which case it's also likely to be the bottleneck of the function execution, so it's advised that this function should have fast implementation.

max_segments

an integer that defines the maximum amount of segments to split the data into.

allow_parallel

allows parallel execution to take place using the registered cluster. Assumes a cluster is registered with the foreach package. Defaults to TRUE.

Details

Function that implements the dynamic programming algorithm, with the intent of finding points of independent change points for which the cost function is minimized. It analyzes all possible combinations, returning the change points that are guaranteed to segment the data matrix in the change points minimize total cost. Because it analyzes all possible combinations of change points, it has a O-squared algorithm complexity, meaning it works in an acceptable computation time for small datasets, but it takes quite longer for datasets with many columns. For big datasets, hieralg() might be more adequate.

Value

a list of type segmentr, which has the two attributes:


thalesmello/segmentr documentation built on March 4, 2020, 1 a.m.