Skip to content

Commit

Permalink
Merge pull request #9 from agosiewska/master
Browse files Browse the repository at this point in the history
Fixes for new version of sets package
  • Loading branch information
agosiewska authored Feb 9, 2022
2 parents c1f974b + 0b092e5 commit 33218f4
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ License: GPL-3
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
Imports:
DALEX,
dendextend,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ importFrom(grDevices,hcl)
importFrom(graphics,plot)
importFrom(ingredients,accumulated_dependence)
importFrom(ingredients,partial_dependence)
importFrom(sets,set)
importFrom(sets,set_union)
importFrom(stats,AIC)
importFrom(stats,aggregate)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# version 0.1.3
- Updated DESCRIPTION (arxiv link changed to doi).
- Added citation to [Simpler is better: Lifting interpretability-performance trade-off via automated feature engineering](https://doi.org/10.1016/j.dss.2021.113556).
- Small fixes for compatibility with `sets` package.

# version 0.1.2

Expand Down
7 changes: 3 additions & 4 deletions R/safely_detect_changepoints.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#' data <- c(rnorm(15, 0), rnorm(20, 2), rnorm(30, 8))
#' safely_detect_changepoints(data)
#' safely_detect_changepoints(data, penalty = 25)
#'
#' @export

safely_detect_changepoints <- function(data, penalty = "MBIC", nquantiles = 10) {
Expand Down Expand Up @@ -120,7 +119,7 @@ cost <- function(data, u, v, sumstat, K) { #function that evaluates cost of data

}

#' @importFrom sets set_union
#' @importFrom sets set_union set
PELT_algorithm <- function(data, penalty_value, sumstat, K) {

if (is.null(data)) {
Expand Down Expand Up @@ -166,13 +165,13 @@ PELT_algorithm <- function(data, penalty_value, sumstat, K) {
#updating R set for next iterations - removing those points that can never be the last optimal changepoint
for (tau in R) {
if (Q[tau+1] + cost(data, tau+1, v, sumstat, K) > Q[v+1] + epsilon) {
R <- R - tau
R <- R - set(tau)
}
}
R <- set_union(R, v)
}

cpts_final <- cp[[n+1]] - 0
cpts_final <- cp[[n+1]] - set(0)

return(sort(unlist(cpts_final)))

Expand Down
2 changes: 1 addition & 1 deletion inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bibentry(bibtype = "Article",
pages = "113556",
year = "2021",
issn = "0167-9236",
doi = "https://doi.org/10.1016/j.dss.2021.113556",
doi = "10.1016/j.dss.2021.113556",
url = "https://www.sciencedirect.com/science/article/pii/S016792362100066X",
author = "Alicja Gosiewska and Anna Kozak and Przemyslaw Biecek",
)
3 changes: 3 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Bemowo
Bielany
CMD
DALEX
doi
dss
GBM
Hannan
Kaggle
Expand Down Expand Up @@ -32,6 +34,7 @@ github
glm
https
interpretable
interpretability
kaggle
mcquitty
param
Expand Down
2 changes: 1 addition & 1 deletion man/rSAFE-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/safely_detect_changepoints.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions tests/testthat/_snaps/extraction/plot-continuous-variable.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions tests/testthat/_snaps/extraction/plot-discrete-variable.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 33218f4

Please sign in to comment.