@@ -26,15 +26,15 @@ import (
2626//
2727// The implementation is based on the following papers:
2828//
29- // [Haynes2017] Kaylea Haynes, Paul Fearnhead, and Idris A. Eckley.
30- // "A computationally efficient nonparametric approach for changepoint detection."
31- // Statistics and Computing 27, no. 5 (2017): 1293-1305.
32- // https://doi.org/10.1007/s11222-016-9687-5
29+ // [Haynes2017] Kaylea Haynes, Paul Fearnhead, and Idris A. Eckley.
30+ // "A computationally efficient nonparametric approach for changepoint detection."
31+ // Statistics and Computing 27, no. 5 (2017): 1293-1305.
32+ // https://doi.org/10.1007/s11222-016-9687-5
3333//
34- // [Killick2012] Rebecca Killick, Paul Fearnhead, and Idris A. Eckley.
35- // "Optimal detection of changepoints with a linear computational cost."
36- // Journal of the American Statistical Association 107, no. 500 (2012): 1590-1598.
37- // https://arxiv.org/pdf/1101.1438.pdf
34+ // [Killick2012] Rebecca Killick, Paul Fearnhead, and Idris A. Eckley.
35+ // "Optimal detection of changepoints with a linear computational cost."
36+ // Journal of the American Statistical Association 107, no. 500 (2012): 1590-1598.
37+ // https://arxiv.org/pdf/1101.1438.pdf
3838func NonParametric (data []float64 , minSegment int ) []int {
3939 if minSegment < 1 {
4040 panic ("minSegment must be positive" )
@@ -66,18 +66,18 @@ func NonParametric(data []float64, minSegment int) []int {
6666
6767// Partial sums for empirical CDF (formula (2.1) from Section 2.1 "Model" in [Haynes2017])
6868//
69- // partialSums'[i, tau] = (count(data[j] < t) * 2 + count(data[j] == t) * 1) for j=0..tau-1
70- // where t is the i-th quantile value (see Section 3.1 "Discrete approximation" in [Haynes2017] for details)
69+ // partialSums'[i, tau] = (count(data[j] < t) * 2 + count(data[j] == t) * 1) for j=0..tau-1
70+ // where t is the i-th quantile value (see Section 3.1 "Discrete approximation" in [Haynes2017] for details)
7171//
7272// In order to get better performance, we present
7373// a two-dimensional array partialSums'[k, n + 1] as a single-dimensional array partialSums[k * (n + 1)].
7474// We assume that partialSums'[i, tau] = partialSums[i * (n + 1) + tau].
7575//
76- // - We use doubled sum values in order to use []int instead of []float64 (it provides noticeable
77- // performance boost). Thus, multipliers for count(data[j] < t) and count(data[j] == t) are
78- // 2 and 1 instead of 1 and 0.5 from the [Haynes2017].
79- // - Note that these quantiles are not uniformly distributed: tails of the data distribution contain more
80- // quantile values than the center of the distribution
76+ // - We use doubled sum values in order to use []int instead of []float64 (it provides noticeable
77+ // performance boost). Thus, multipliers for count(data[j] < t) and count(data[j] == t) are
78+ // 2 and 1 instead of 1 and 0.5 from the [Haynes2017].
79+ // - Note that these quantiles are not uniformly distributed: tails of the data distribution contain more
80+ // quantile values than the center of the distribution
8181func edPartialSums (data []float64 , k int ) []int32 {
8282 n := len (data )
8383 partialSums := make ([]int32 , k * (n + 1 ))
0 commit comments