Skip to content

Commit

Permalink
Adjust mean change cost function
Browse files Browse the repository at this point in the history
  • Loading branch information
doccstat committed Jan 9, 2024
1 parent 881a28d commit a7447fd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/fastcpd_class_cost.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ List Fastcpd::negative_log_likelihood_wo_theta(
arma::trace(
solve(mean_data_cov, residuals.t() * residuals)
) / data.n_rows
),
) + data.n_cols * log(data.n_rows),
Named("residuals") = residuals
);
} else if (family == "variance") {
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-coverage.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ testthat::test_that(
set.seed(1)
data <- c(rnorm(300, 0, 100), rnorm(400, 100, 100), rnorm(300, 0, 100))
result_mean <- fastcpd.mean(data)
testthat::expect_equal(result_mean@cp_set, c(294, 702))
testthat::expect_equal(result_mean@cp_set, c(300, 702))
}
)

Expand Down Expand Up @@ -102,6 +102,6 @@ testthat::test_that(
testthat::test_that("beta x2", {
testthat::expect_equal(
fastcpd.mean(well_log, beta = log(length(well_log)))@cp_set,
c(566, 740, 1039, 1198, 1424, 1661, 1842, 2023, 2476, 2744, 3709, 3820)
c(572, 1039, 1424, 1661, 1842, 2023, 2476, 2744, 3709, 3820)
)
})
4 changes: 2 additions & 2 deletions tests/testthat/test-examples-data-transcriptome.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ testthat::test_that(
testthat::expect_equal(
result@cp_set,
c(
177, 264, 394, 534, 579, 656, 788, 811, 869, 934,
966, 1051, 1141, 1286, 1319, 1368, 1568, 1657,
177, 264, 401, 534, 579, 656, 788, 811, 869,
934, 966, 1051, 1141, 1286, 1319, 1386, 1657,
1724, 1906, 1972, 1996, 2041, 2146, 2200
)
)
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-examples-data-well_log.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ testthat::test_that(
testthat::expect_equal(
result@cp_set,
c(
10, 566, 704, 776, 1021, 1057, 1198, 1347, 1406, 1502,
1660, 1842, 2023, 2202, 2384, 2445, 2507, 2567, 2749,
2921, 3072, 3509, 3622, 3709, 3820, 3976
10, 572, 704, 830, 1021, 1057, 1198, 1347,
1406, 1502, 1660, 1842, 2023, 2385, 2445,
2507, 2567, 2749, 3709, 3820, 3976
)
)
}
Expand Down
2 changes: 1 addition & 1 deletion vignettes/comparison-packages.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ vignette: >

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE, comment = "#>", eval = TRUE, cache = TRUE,
collapse = TRUE, comment = "#>", eval = TRUE, cache = FALSE,
warning = FALSE, fig.width = 8, fig.height = 5
)
```
Expand Down

0 comments on commit a7447fd

Please sign in to comment.