Description Usage Arguments Value Examples
Segment neighborhood algorithm for change-in-slope problem with a finite number of states (beginning and ending values of each segment is restricted to a finite set of values called states). The algorithm takes into account a continuity constraint between successive segments and infers a continuous piecewise linear signal with a given number of segments.
1 2 |
data |
vector of data to segment: a univariate time series |
states |
vector of states = set of accessible starting/ending values for segments in increasing order. |
nbSegments |
the number of segments to infer |
constraint |
string defining a constraint : "null", "isotonic" |
testMode |
a boolean, if true the function also returns the percent of elements to scan (= ratio scanned elements vs. scanned elements if no pruning) |
a list of 3 elements = (changepoints, states, globalCost). (Pruning is optional)
changepoints
is the vector of changepoints (we return the extremal values of all segments from left to right)
states
is the vector of successive states. states[i] is the value we inferred at position changepoints[i]
globalCost
is a number equal to the global cost of the non-penalized change-in-slope problem. That is the value of the fit to the data ignoring the penalties for adding changes
is the percent of positions to consider in cost matrix Q (returned only if testMode = TRUE)
1 2 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.