| fastlr_split | R Documentation |
Finds the split of a binary sequence that maximises the
log-likelihood ratio between two Bernoulli segments and a single one
(problem Change of Tatti, 2019), searching only the border indices, with
the (1 - \epsilon) approximation of Algorithm 3 when eps > 0.
fastlr_split(x, eps = 0)
x |
Binary vector (0/1 or logical). |
eps |
Approximation guarantee, in [0, 1): the returned score is at
least |
A list with score (log-likelihood ratio, natural logarithm),
index (the first entry of the second segment; length(x) + 1 or 1 when
no split improves the likelihood), tests (number of evaluated change points),
candidates (candidates of FindCands, without the FindSegment points)
and blocks (number of border indices of the sequence and of the flipped
sequence).
Tatti, N. (2019). Fast likelihood-based change point detection. In Machine Learning and Knowledge Discovery in Databases (ECML PKDD 2019), 662-677. doi:10.1007/978-3-030-46150-8_39. arXiv:2301.08892.
set.seed(1)
x <- c(rbinom(300, 1, 0.2), rbinom(200, 1, 0.6))
fastlr_split(x)
fastlr_split(x, eps = 0.5)$score
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.