diff --git a/.Rbuildignore b/.Rbuildignore index 1cd393c..81f524f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -7,6 +7,7 @@ ^cran-comments\.md$ ^packrat/ ^docs/ +^dev/ ^\.Rprofile$ ^\.travis\.yml$ ^.*\.Rproj$ diff --git a/DESCRIPTION b/DESCRIPTION index b8bfcfc..2ebe0ae 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: tsmp Type: Package Title: Time Series with Matrix Profile -Version: 0.3.5.9001 +Version: 0.3.5.9000 Authors@R: c( person("Francisco", "Bischoff", email = "fbischoff@med.up.pt", role = c("aut", "cre"), comment = c(ORCID = "https://orcid.org/0000-0002-5301-8672")), @@ -29,11 +29,12 @@ LazyData: true Roxygen: list(markdown = TRUE) RoxygenNote: 6.1.1.9000 NeedsCompilation: no -Suggests: +Suggests: spelling, testthat, knitr, rmarkdown, gdtools, - vdiffr + vdiffr, + animation VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index e47b49e..54d4899 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,17 @@ # Generated by roxygen2: do not edit by hand +S3method("[",AnnotationVector) +S3method("[",ArcCount) +S3method("[",Chain) +S3method("[",Discord) +S3method("[",Floss) +S3method("[",Fluss) +S3method("[",MatrixProfile) +S3method("[",Motif) +S3method("[",MultiMatrixProfile) +S3method("[",MultiMotif) +S3method("[",Salient) +S3method("[",SimpleMatrixProfile) S3method(find_discord,MatrixProfile) S3method(find_motif,MatrixProfile) S3method(find_motif,MultiMatrixProfile) diff --git a/NEWS.md b/NEWS.md index de4e079..1320f68 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,7 @@ NEWS ================ Francisco Bischoff -\- 01 Jun 2019 +\- 03 Jun 2019 diff --git a/R/dist_profile.R b/R/dist_profile.R index 189c322..fbbfcb3 100644 --- a/R/dist_profile.R +++ b/R/dist_profile.R @@ -61,9 +61,11 @@ #' # weighted #' weight <- c(rep(1, w / 3), rep(0.5, w / 3), rep(0.8, w / 3)) # just an example #' -#' nn <- dist_profile(ref_data, ref_data, window_size = w, index = 1, method = "weighted", weight = weight) +#' nn <- dist_profile(ref_data, ref_data, window_size = w, index = 1, method = "weighted", +#' weight = weight) #' distance_profile <- Re(sqrt(nn$distance_profile)) -dist_profile <- function(data, query, ..., window_size = NULL, method = "v3", index = 1, k = NULL, weight = NULL, paa = 1) { +dist_profile <- function(data, query, ..., window_size = NULL, method = "v3", index = 1, k = NULL, + weight = NULL, paa = 1) { ## ---- Verify if method exists ---- # set as v3 if no method is entered diff --git a/R/fluss.R b/R/fluss.R index 424eb03..48d5f50 100644 --- a/R/fluss.R +++ b/R/fluss.R @@ -82,7 +82,7 @@ floss <- function(.mp, new_data, data_window, threshold = 1, exclusion_zone = NU .mp$cac_final <- NULL return(.mp) } else { - .mp <- stompi_update(.mp, head(new_data, data_window - data_size)) + .mp <- stompi_update(.mp, utils::head(new_data, data_window - data_size)) new_data <- new_data[(data_window - data_size + 1):new_data_size] } } @@ -103,7 +103,7 @@ floss <- function(.mp, new_data, data_window, threshold = 1, exclusion_zone = NU .mp$cac_final <- c( rep(NA, chunk_size + mp_offset - chunk_size), - head(.mp$cac, -(round(data_window * (1 - vars()$kmode) - (1 - vars()$kmode) * .mp$w) - 0.5 * chunk_size + ifelse(mp_offset > 0, 1, 2))) + utils::head(.mp$cac, -(round(data_window * (1 - vars()$kmode) - (1 - vars()$kmode) * .mp$w) - 0.5 * chunk_size + ifelse(mp_offset > 0, 1, 2))) ) na_head <- round(vars()$kmode * data_window + (0.5 * chunk_size - vars()$kmode * .mp$w)) + mp_offset @@ -130,7 +130,7 @@ floss <- function(.mp, new_data, data_window, threshold = 1, exclusion_zone = NU res <- floss_extract(.mp, threshold) if (!keep_cac) { - res$cac_final <- tail(res$cac_final, -length(new_data)) + res$cac_final <- utils::tail(res$cac_final, -length(new_data)) } return(res) @@ -179,9 +179,9 @@ floss_extract <- function(.mpac, threshold = 1, exclusion_zone = NULL) { new_data <- ifelse(is.null(attr(.mpac, "new_data")), 0, attr(.mpac, "new_data")) if (offset == 0 || cac_fin_len == floor((mp_len * vars()$kmode + new_data * 1.5))) { - cac <- tail(.mpac$cac_final, -new_data) + cac <- utils::tail(.mpac$cac_final, -new_data) } else { - cac <- tail(.mpac$cac_final, -offset) + cac <- utils::tail(.mpac$cac_final, -offset) } cac[cac > threshold] <- NA diff --git a/R/mass-pre-w.R b/R/mass-pre-w.R index 0de50a6..01b4a11 100644 --- a/R/mass-pre-w.R +++ b/R/mass-pre-w.R @@ -20,7 +20,8 @@ #' w <- mp_toy_data$sub_len #' ref_data <- mp_toy_data$data[, 1] #' query_data <- mp_toy_data$data[, 1] -#' weight <- c(rep(1, mp_toy_data$sub_len / 3), rep(0.5, mp_toy_data$sub_len / 3), rep(1, mp_toy_data$sub_len / 3)) +#' weight <- c(rep(1, mp_toy_data$sub_len / 3), rep(0.5, mp_toy_data$sub_len / 3), +#' rep(1, mp_toy_data$sub_len / 3)) #' #' pre <- tsmp:::mass_pre_w(ref_data, query_data, w, weight) #' diff --git a/R/mass.R b/R/mass.R index 26518e2..62db374 100644 --- a/R/mass.R +++ b/R/mass.R @@ -22,7 +22,8 @@ #' @references Website: #' @name mass-deprecated -#' @usage mass(data_fft, query_window, data_size, window_size, data_mean, data_sd, query_mean, query_sd) +#' @usage mass(data_fft, query_window, data_size, window_size, data_mean, data_sd, +#' query_mean, query_sd) #' @seealso \code{\link{tsmp-deprecated}} #' @keywords internal NULL @@ -33,7 +34,8 @@ NULL #' #' @export -mass <- function(data_fft, query_window, data_size, window_size, data_mean, data_sd, query_mean, query_sd) { +mass <- function(data_fft, query_window, data_size, window_size, data_mean, data_sd, + query_mean, query_sd) { .Deprecated("dist_profile") # pre-process query for fft query_window <- rev(query_window) diff --git a/R/mass_weighted.R b/R/mass_weighted.R index 068cd3f..2022fde 100644 --- a/R/mass_weighted.R +++ b/R/mass_weighted.R @@ -28,7 +28,8 @@ #' w <- mp_toy_data$sub_len #' ref_data <- mp_toy_data$data[, 1] #' query_data <- mp_toy_data$data[, 1] -#' weight <- c(rep(1, mp_toy_data$sub_len / 3), rep(0.5, mp_toy_data$sub_len / 3), rep(1, mp_toy_data$sub_len / 3)) +#' weight <- c(rep(1, mp_toy_data$sub_len / 3), rep(0.5, mp_toy_data$sub_len / 3), +#' rep(1, mp_toy_data$sub_len / 3)) #' #' pre <- tsmp:::mass_pre_w(ref_data, query_data, w, weight) #' @@ -39,7 +40,8 @@ #' pre$data_mean, pre$data_sd, pre$data_pre, pre$weight #' ) #' } -mass_weighted <- function(query_window, window_size, data_fft, data_size, data_mean, data_sd, data_pre, weight, ...) { +mass_weighted <- function(query_window, window_size, data_fft, data_size, data_mean, data_sd, + data_pre, weight, ...) { if (length(weight) != window_size) { stop("'weight' must have the same length as the 'window_size'.") } diff --git a/R/plot.R b/R/plot.R index 205e8c9..9abb0b3 100644 --- a/R/plot.R +++ b/R/plot.R @@ -29,6 +29,8 @@ #' @param ylab a `string`. (Default is `""`). Y label. #' @param xlab a `string`. (Default is `"Profile Index"`). X label. #' @param ... further arguments to be passed to [plot()]. See [par()]. +#' @param xmin an `int`. (Default is `NULL`). Set the minimum value of x axis. +#' @param xmax an `int`. (Default is `NULL`). Set the maximum value of x axis. #' #' @return None #' @keywords hplot @@ -164,8 +166,8 @@ plot.ArcCount <- function(x, data, type = c("data", "matrix"), exclusion_zone = if (cac_size < nrow(profile_index)) { warning("cac_size < profile_index") cac_offset <- nrow(profile_index) - cac_size - plot_data <- as.matrix(tail(plot_data, cac_size)) - profile_index <- as.matrix(tail(profile_index, cac_size) - cac_offset) + plot_data <- as.matrix(utils::tail(plot_data, cac_size)) + profile_index <- as.matrix(utils::tail(profile_index, cac_size) - cac_offset) } xnum <- seq_len(nrow(x$mp) + min(x$w) - 1) @@ -390,7 +392,7 @@ plot.SimpleMatrixProfile <- function(x, ylab = "distance", xlab = "index", main if (n_dim > 1) { for (i in 2:n_dim) { - lines(xnum, x$data[[1]][, i], main = paste0("Data"), ylab = "", xlab = xlab, col = i, ...) + graphics::lines(xnum, x$data[[1]][, i], main = paste0("Data"), ylab = "", xlab = xlab, col = i, ...) } } @@ -402,7 +404,7 @@ plot.SimpleMatrixProfile <- function(x, ylab = "distance", xlab = "index", main if (n_dim > 1) { for (i in 2:n_dim) { - lines(xnum, x$data[[2]][, i], main = paste0("Data"), ylab = "", xlab = xlab, col = i, ...) + graphics::lines(xnum, x$data[[2]][, i], main = paste0("Data"), ylab = "", xlab = xlab, col = i, ...) } } } @@ -540,7 +542,7 @@ plot.Floss <- function(x, data, type = c("data", "matrix"), if (cac_fin_len == floor((mp_len * vars()$kmode + new_data / 2))) { cac <- x$cac_final } else { - cac <- tail(x$cac_final, -offset) + cac <- utils::tail(x$cac_final, -offset) } cac_size <- length(cac) cac <- c(cac, rep(NA, nrow(x$mp) + min(x$w) - 1 - cac_size)) diff --git a/R/stompi.R b/R/stompi.R index 635a352..ada5745 100644 --- a/R/stompi.R +++ b/R/stompi.R @@ -95,16 +95,16 @@ stompi_update <- function(.mp, new_data, history_size = FALSE) { } if (history_size && (data_upd_size > history_size)) { - data_upd <- tail(data_upd, history_size) + data_upd <- utils::tail(data_upd, history_size) mp_new_size <- history_size - .mp$w + 1 offset <- data_upd_size - history_size - mp_new <- tail(mp_new, mp_new_size) - pi_new <- tail(pi_new - offset, mp_new_size) - lmp_new <- tail(lmp_new, mp_new_size) - lpi_new <- tail(lpi_new - offset, mp_new_size) - rmp_new <- tail(rmp_new, mp_new_size) - rpi_new <- tail(rpi_new - offset, mp_new_size) + mp_new <- utils::tail(mp_new, mp_new_size) + pi_new <- utils::tail(pi_new - offset, mp_new_size) + lmp_new <- utils::tail(lmp_new, mp_new_size) + lpi_new <- utils::tail(lpi_new - offset, mp_new_size) + rmp_new <- utils::tail(rmp_new, mp_new_size) + rpi_new <- utils::tail(rpi_new - offset, mp_new_size) if (is.null(attr(.mp, "offset"))) { attr(.mp, "offset") <- offset @@ -112,7 +112,7 @@ stompi_update <- function(.mp, new_data, history_size = FALSE) { attr(.mp, "offset") <- attr(.mp, "offset") + offset } - # pi_new <- tail(pi_new - attr(.mp, "offset"), mp_new_size) + # pi_new <- utils::tail(pi_new - attr(.mp, "offset"), mp_new_size) } .mp$mp <- as.matrix(mp_new) @@ -126,7 +126,7 @@ stompi_update <- function(.mp, new_data, history_size = FALSE) { # TODO: with tail or not (tail will recompute some things) # if (history_size && (data_upd_size > history_size)) { - # return(tail(.mp, history_size)) + # return(utils::tail(.mp, history_size)) # } else { return(.mp) # } diff --git a/R/subset.R b/R/subset.R index 4bf9080..436424b 100644 --- a/R/subset.R +++ b/R/subset.R @@ -1,5 +1,10 @@ #---- Subset Chains ---- +#' @export +#' @keywords internal +#' @noRd +#' + `[.Chain` <- function(x, ..., drop = FALSE) { x <- NextMethod(object = x) attr(x, "subsetting") <- "Chains" @@ -41,6 +46,11 @@ #---- Subset Salient ---- +#' @export +#' @keywords internal +#' @noRd +#' + `[.Salient` <- function(x, ..., drop = FALSE) { x <- NextMethod(object = x) attr(x, "subsetting") <- "Salient" @@ -63,6 +73,11 @@ #---- Subset Annotations ---- +#' @export +#' @keywords internal +#' @noRd +#' + `[.AnnotationVector` <- function(x, ..., drop = FALSE) { x <- NextMethod(object = x) attr(x, "subsetting") <- "AnnotationVector" @@ -83,6 +98,12 @@ } #---- Subset Fluss ---- + +#' @export +#' @keywords internal +#' @noRd +#' + `[.Fluss` <- function(x, ..., drop = FALSE) { x <- NextMethod(object = x) attr(x, "subsetting") <- "Fluss" @@ -93,7 +114,12 @@ x } -# + +#' @export +#' @keywords internal +#' @noRd +#' + `[.Floss` <- function(x, ..., drop = FALSE) { x <- NextMethod(object = x) attr(x, "subsetting") <- "Floss" @@ -104,7 +130,12 @@ x } -# + +#' @export +#' @keywords internal +#' @noRd +#' + `[.ArcCount` <- function(x, ..., drop = FALSE) { x <- NextMethod(object = x) attr(x, "subsetting") <- "ArcCount" @@ -118,6 +149,11 @@ #---- Subset Discord ---- +#' @export +#' @keywords internal +#' @noRd +#' + `[.Discord` <- function(x, ..., drop = FALSE) { x <- NextMethod(object = x) attr(x, "subsetting") <- "Discord" @@ -161,6 +197,11 @@ #---- Subset Motifs ---- +#' @export +#' @keywords internal +#' @noRd +#' + `[.MultiMotif` <- function(x, ..., drop = FALSE) { x <- NextMethod(object = x) attr(x, "subsetting") <- "MultiMotif" @@ -204,6 +245,11 @@ x } +#' @export +#' @keywords internal +#' @noRd +#' + `[.Motif` <- function(x, ..., drop = FALSE) { x <- NextMethod(object = x) attr(x, "subsetting") <- "Motif" @@ -247,6 +293,11 @@ #---- Subset Matrices ---- +#' @export +#' @keywords internal +#' @noRd +#' + `[.MatrixProfile` <- function(x, ..., drop = FALSE) { # str(...) # y <- NextMethod("[") @@ -330,6 +381,11 @@ } } +#' @export +#' @keywords internal +#' @noRd +#' + `[.MultiMatrixProfile` <- function(x, ..., drop = FALSE) { subset <- c(...) sub_size <- length(subset) @@ -393,6 +449,11 @@ } } +#' @export +#' @keywords internal +#' @noRd +#' + `[.SimpleMatrixProfile` <- function(x, ..., drop = FALSE) { subset <- c(...) sub_size <- length(subset) @@ -482,10 +543,12 @@ head.MatrixProfile <- function(x, n = 2 * max(x$w), ...) { return(x[1:ed_idx]) } + head.MultiMatrixProfile <- function(x, n = 2 * max(x$w), ...) { return(head.MatrixProfile(x, n, ...)) } + head.SimpleMatrixProfile <- function(x, n = 2 * max(x$w), ...) { return(head.MatrixProfile(x, n, ...)) } diff --git a/R/tsmp.R b/R/tsmp.R index 7fe54e0..a8a86e5 100644 --- a/R/tsmp.R +++ b/R/tsmp.R @@ -65,6 +65,7 @@ #' @param exc_dim an `int` or `vector` of which dimensions to exclude (default is `NULL`). See #' details. #' @param heap_size an `int`. (Default is `50`). Size of the distance profile heap buffer. +#' @param paa an `int`. (Default is `1`). Factor of PAA reduction (2 == half of size) #' @param .keep_data a `logical`. (Default is `TRUE`). Keeps the data embedded to resultant object. #' #' @return Returns the matrix profile `mp` and profile index `pi`. It also returns the left and diff --git a/README.md b/README.md index 6c8dba7..cf7cbd5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ README ================ Francisco Bischoff -\- 01 Jun 2019 +\- 03 Jun 2019 diff --git a/cran-comments.md b/cran-comments.md index cd11751..78de17c 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,5 +1,5 @@ ## Comments - +Added one suggestion package: annimation ## Test environments * Rhub diff --git a/docs/CODE_OF_CONDUCT.html b/docs/CODE_OF_CONDUCT.html index c580cc3..e764be8 100644 --- a/docs/CODE_OF_CONDUCT.html +++ b/docs/CODE_OF_CONDUCT.html @@ -63,7 +63,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 diff --git a/docs/CONTRIBUTING.html b/docs/CONTRIBUTING.html index b43916d..e6f8c59 100644 --- a/docs/CONTRIBUTING.html +++ b/docs/CONTRIBUTING.html @@ -63,7 +63,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 diff --git a/docs/LICENSE.html b/docs/LICENSE.html index ceee57e..6403d2c 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -63,7 +63,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 @@ -119,7 +119,7 @@

GNU General Public License

-

Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

+

Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

@@ -138,9 +138,9 @@

TERMS AND CONDITIONS

-
+

-0. Definitions

+0. Definitions

“This License” refers to version 3 of the GNU General Public License.

“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.

“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.

@@ -150,9 +150,9 @@

To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.

An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.

-
+

-1. Source Code

+1. Source Code

The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.

A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.

The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.

@@ -160,28 +160,28 @@

The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.

The Corresponding Source for a work in source code form is that same work.

-
+

-2. Basic Permissions

+2. Basic Permissions

All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.

You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.

Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.

- diff --git a/docs/reference/mp_test_data.html b/docs/reference/mp_test_data.html index 6aced60..0054463 100644 --- a/docs/reference/mp_test_data.html +++ b/docs/reference/mp_test_data.html @@ -66,7 +66,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016
diff --git a/docs/reference/mp_toy_data.html b/docs/reference/mp_toy_data.html index 6658603..71fc1f9 100644 --- a/docs/reference/mp_toy_data.html +++ b/docs/reference/mp_toy_data.html @@ -65,7 +65,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016
diff --git a/docs/reference/mstomp.html b/docs/reference/mstomp.html index 3f9aec8..626ac45 100644 --- a/docs/reference/mstomp.html +++ b/docs/reference/mstomp.html @@ -65,7 +65,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016
@@ -224,7 +224,7 @@

Examp # force using dimensions 1 and 2 mp <- mstomp(mp_toy_data$data[1:200, ], 30, must_dim = c(1, 2)) # exclude dimensions 2 and 3 -mp <- mstomp(mp_toy_data$data[1:200, ], 30, exc_dim = c(2, 3)) +mp2 <- mstomp(mp_toy_data$data[1:200, ], 30, exc_dim = c(2, 3)) # }
diff --git a/docs/reference/pipe.html b/docs/reference/pipe.html index c6869fc..d87926b 100644 --- a/docs/reference/pipe.html +++ b/docs/reference/pipe.html @@ -66,7 +66,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 diff --git a/docs/reference/plot-1.png b/docs/reference/plot-1.png index d194833..0b66c4e 100644 Binary files a/docs/reference/plot-1.png and b/docs/reference/plot-1.png differ diff --git a/docs/reference/plot.html b/docs/reference/plot.html index 1c8aa38..c56ea0f 100644 --- a/docs/reference/plot.html +++ b/docs/reference/plot.html @@ -65,7 +65,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 @@ -135,11 +135,11 @@

Plot a TSMP object

# S3 method for Valmod plot(x, ylab = "distance", xlab = "index", - main = "Valmod Matrix Profile", ...) + main = "Valmod Matrix Profile", data = FALSE, ...) # S3 method for MatrixProfile plot(x, ylab = "distance", xlab = "index", - main = "Unidimensional Matrix Profile", ...) + main = "Unidimensional Matrix Profile", data = FALSE, ...) # S3 method for MultiMatrixProfile plot(x, ylab = "distance", xlab = "index", @@ -147,13 +147,18 @@

Plot a TSMP object

# S3 method for SimpleMatrixProfile plot(x, ylab = "distance", - xlab = "index", main = "SiMPle Matrix Profile", ...) + xlab = "index", main = "SiMPle Matrix Profile", data = FALSE, ...) # S3 method for Fluss plot(x, data, type = c("data", "matrix"), main = "Fast Low-cost Unipotent Semantic Segmentation", xlab = "index", ylab = "", ...) +# S3 method for Floss +plot(x, data, type = c("data", "matrix"), + main = "Fast Low-cost Online Semantic Segmentation", xlab = "index", + ylab = "", ...) + # S3 method for Chain plot(x, data, type = c("data", "matrix"), main = "Chain Discover", xlab = "index", ylab = "", ...) diff --git a/docs/reference/plot_arcs-1.png b/docs/reference/plot_arcs-1.png index 6427ab3..035908a 100644 Binary files a/docs/reference/plot_arcs-1.png and b/docs/reference/plot_arcs-1.png differ diff --git a/docs/reference/plot_arcs.html b/docs/reference/plot_arcs.html index 869bd95..0925fa9 100644 --- a/docs/reference/plot_arcs.html +++ b/docs/reference/plot_arcs.html @@ -68,7 +68,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 @@ -135,7 +135,7 @@

Plot arcs between indexes of a Profile Index

plot_arcs(pairs, alpha = NULL, quality = 30, lwd = 15,
   col = c("blue", "orange"), main = "Arc Plot", ylab = "",
-  xlab = "Profile Index", ...)
+ xlab = "Profile Index", xmin = NULL, xmax = NULL, ...)

Arguments

@@ -174,6 +174,14 @@

Arg

+ + + + + + + + diff --git a/docs/reference/remove_class.html b/docs/reference/remove_class.html new file mode 100644 index 0000000..4c7ae08 --- /dev/null +++ b/docs/reference/remove_class.html @@ -0,0 +1,186 @@ + + + + + + + + +Remove a <code>TSMP</code> class from an object — remove_class • tsmp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
+ +

Remove a TSMP class from an object

+ +
+ +
remove_class(x, class)
+ +

Arguments

+
xlab

a string. (Default is "Profile Index"). X label.

xmin

an int. (Default is NULL). Set the minimum value of x axis.

xmax

an int. (Default is NULL). Set the maximum value of x axis.

...

further arguments to be passed to plot(). See par().

+ + + + + + + + + +
x

a TSMP object

class

character string with the class name

+ +

Value

+ +

the object without the class

+ + +

Examples

+
w <- 50 +data <- mp_gait_data +mp <- tsmp(data, window_size = w, exclusion_zone = 1 / 4, verbose = 0) +mp <- find_chains(mp) +# Remove the "Chain" class information +mp <- remove_class(mp, "Chain")
+ + + + + + + + + + + + diff --git a/docs/reference/salient_mds-1.png b/docs/reference/salient_mds-1.png index fc7a59d..f68a52c 100644 Binary files a/docs/reference/salient_mds-1.png and b/docs/reference/salient_mds-1.png differ diff --git a/docs/reference/salient_mds.html b/docs/reference/salient_mds.html index c721142..741216d 100644 --- a/docs/reference/salient_mds.html +++ b/docs/reference/salient_mds.html @@ -65,7 +65,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 diff --git a/docs/reference/salient_score.html b/docs/reference/salient_score.html index 36a7de4..45b82a4 100644 --- a/docs/reference/salient_score.html +++ b/docs/reference/salient_score.html @@ -67,7 +67,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 diff --git a/docs/reference/salient_subsequences.html b/docs/reference/salient_subsequences.html index 12ef9d6..7aec2f5 100644 --- a/docs/reference/salient_subsequences.html +++ b/docs/reference/salient_subsequences.html @@ -66,7 +66,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 diff --git a/docs/reference/scrimp.html b/docs/reference/scrimp.html index 8e8ad36..31ef41e 100644 --- a/docs/reference/scrimp.html +++ b/docs/reference/scrimp.html @@ -67,7 +67,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 diff --git a/docs/reference/sdts_predict.html b/docs/reference/sdts_predict.html index 5bf76d0..5dc3de9 100644 --- a/docs/reference/sdts_predict.html +++ b/docs/reference/sdts_predict.html @@ -69,7 +69,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 @@ -181,7 +181,17 @@

Examp tr_label <- mp_test_data$train$label[subs] te_data <- mp_test_data$test$data[subs] te_label <- mp_test_data$test$label[subs] -model <- sdts_train(tr_data, tr_label, w, verbose = 0)
#> Error in { work_len <- length(idx_work[[i]]) pro_muls <- matrix(Inf, matrix_profile_size, 1) pro_idxs <- matrix(-1, matrix_profile_size, 1) if (length(args) > 1) { pro_muls_right <- pro_muls_left <- NULL pro_idxs_right <- pro_idxs_left <- NULL } else { pro_muls_right <- pro_muls_left <- pro_muls pro_idxs_right <- pro_idxs_left <- pro_idxs } dist_pro <- matrix(0, matrix_profile_size, 1) last_product <- matrix(0, matrix_profile_size, 1) drop_value <- matrix(0, 1, 1) for (j in 1:work_len) { idx_st <- idx_work[[i]][1] idx_ed <- idx_work[[i]][work_len] idx <- idx_work[[i]][j] query_window <- as.matrix(query[idx:(idx + window_size - 1), 1]) if (j == 1) { nni <- dist_profile(data, query, nn, index = idx) dist_pro[, 1] <- nni$distance_profile last_product[, 1] <- nni$last_product } else { last_product[2:(data_size - window_size + 1), 1] <- last_product[1:(data_size - window_size), 1] - data[1:(data_size - window_size), 1] * drop_value + data[(window_size + 1):data_size, 1] * query_window[window_size, 1] last_product[1, 1] <- first_product[idx, 1] dist_pro <- 2 * (window_size - (last_product - window_size * nni$par$data_mean * nni$par$query_mean[idx])/(nni$par$data_sd * nni$par$query_sd[idx])) } dist_pro <- Re(sqrt(dist_pro)) drop_value <- query_window[1, 1] if (exclusion_zone > 0) { exc_st <- max(1, idx - exclusion_zone) exc_ed <- min(matrix_profile_size, idx + exclusion_zone) dist_pro[exc_st:exc_ed, 1] <- Inf } dist_pro[nni$par$data_sd < vars()$eps] <- Inf if (skip_location[idx] || any(nni$par$query_sd[idx] < vars()$eps)) { dist_pro[] <- Inf } dist_pro[skip_location] <- Inf if (length(args) == 1) { ind <- (dist_pro[idx:matrix_profile_size] < pro_muls_left[idx:matrix_profile_size]) ind <- c(rep(FALSE, (idx - 1)), ind) pro_muls_left[ind] <- dist_pro[ind] pro_idxs_left[which(ind)] <- idx ind <- (dist_pro[1:idx] < pro_muls_right[1:idx]) ind <- c(ind, rep(FALSE, matrix_profile_size - idx)) pro_muls_right[ind] <- dist_pro[ind] pro_idxs_right[which(ind)] <- idx } ind <- (dist_pro < pro_muls) pro_muls[ind] <- dist_pro[ind] pro_idxs[which(ind)] <- idx } res <- list(pro_muls = pro_muls, pro_idxs = pro_idxs, pro_muls_left = pro_muls_left, pro_idxs_left = pro_idxs_left, pro_muls_right = pro_muls_right, pro_idxs_right = pro_idxs_right) res}: task 2 failed - "NAs are not allowed in subscripted assignments"
predict <- sdts_predict(model, te_data, round(mean(w)))
#> Error in sdts_predict(model, te_data, round(mean(w))): object 'model' not found
sdts_score(predict, te_label, 1)
#> Error in pred_tmp[seq_len(length(pred))] <- pred: incompatible types (from closure to logical) in subassignment type fix
# NOT RUN { +model <- sdts_train(tr_data, tr_label, w, verbose = 0) +predict <- sdts_predict(model, te_data, round(mean(w))) +sdts_score(predict, te_label, 1)
#> $f_score +#> [1] 0.125 +#> +#> $precision +#> [1] 0.06666667 +#> +#> $recall +#> [1] 1 +#>
# NOT RUN { windows <- c(110, 220, 330) model <- sdts_train(mp_test_data$train$data, mp_test_data$train$label, windows, verbose = 0) predict <- sdts_predict(model, mp_test_data$test$data, round(mean(windows))) diff --git a/docs/reference/sdts_score.html b/docs/reference/sdts_score.html index ba7e6cd..defc47d 100644 --- a/docs/reference/sdts_score.html +++ b/docs/reference/sdts_score.html @@ -65,7 +65,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 @@ -177,7 +177,17 @@

Examp tr_label <- mp_test_data$train$label[subs] te_data <- mp_test_data$test$data[subs] te_label <- mp_test_data$test$label[subs] -model <- sdts_train(tr_data, tr_label, w, verbose = 0)
#> Error in { work_len <- length(idx_work[[i]]) pro_muls <- matrix(Inf, matrix_profile_size, 1) pro_idxs <- matrix(-1, matrix_profile_size, 1) if (length(args) > 1) { pro_muls_right <- pro_muls_left <- NULL pro_idxs_right <- pro_idxs_left <- NULL } else { pro_muls_right <- pro_muls_left <- pro_muls pro_idxs_right <- pro_idxs_left <- pro_idxs } dist_pro <- matrix(0, matrix_profile_size, 1) last_product <- matrix(0, matrix_profile_size, 1) drop_value <- matrix(0, 1, 1) for (j in 1:work_len) { idx_st <- idx_work[[i]][1] idx_ed <- idx_work[[i]][work_len] idx <- idx_work[[i]][j] query_window <- as.matrix(query[idx:(idx + window_size - 1), 1]) if (j == 1) { nni <- dist_profile(data, query, nn, index = idx) dist_pro[, 1] <- nni$distance_profile last_product[, 1] <- nni$last_product } else { last_product[2:(data_size - window_size + 1), 1] <- last_product[1:(data_size - window_size), 1] - data[1:(data_size - window_size), 1] * drop_value + data[(window_size + 1):data_size, 1] * query_window[window_size, 1] last_product[1, 1] <- first_product[idx, 1] dist_pro <- 2 * (window_size - (last_product - window_size * nni$par$data_mean * nni$par$query_mean[idx])/(nni$par$data_sd * nni$par$query_sd[idx])) } dist_pro <- Re(sqrt(dist_pro)) drop_value <- query_window[1, 1] if (exclusion_zone > 0) { exc_st <- max(1, idx - exclusion_zone) exc_ed <- min(matrix_profile_size, idx + exclusion_zone) dist_pro[exc_st:exc_ed, 1] <- Inf } dist_pro[nni$par$data_sd < vars()$eps] <- Inf if (skip_location[idx] || any(nni$par$query_sd[idx] < vars()$eps)) { dist_pro[] <- Inf } dist_pro[skip_location] <- Inf if (length(args) == 1) { ind <- (dist_pro[idx:matrix_profile_size] < pro_muls_left[idx:matrix_profile_size]) ind <- c(rep(FALSE, (idx - 1)), ind) pro_muls_left[ind] <- dist_pro[ind] pro_idxs_left[which(ind)] <- idx ind <- (dist_pro[1:idx] < pro_muls_right[1:idx]) ind <- c(ind, rep(FALSE, matrix_profile_size - idx)) pro_muls_right[ind] <- dist_pro[ind] pro_idxs_right[which(ind)] <- idx } ind <- (dist_pro < pro_muls) pro_muls[ind] <- dist_pro[ind] pro_idxs[which(ind)] <- idx } res <- list(pro_muls = pro_muls, pro_idxs = pro_idxs, pro_muls_left = pro_muls_left, pro_idxs_left = pro_idxs_left, pro_muls_right = pro_muls_right, pro_idxs_right = pro_idxs_right) res}: task 2 failed - "NAs are not allowed in subscripted assignments"
predict <- sdts_predict(model, te_data, round(mean(w)))
#> Error in sdts_predict(model, te_data, round(mean(w))): object 'model' not found
sdts_score(predict, te_label, 1)
#> Error in pred_tmp[seq_len(length(pred))] <- pred: incompatible types (from closure to logical) in subassignment type fix
# NOT RUN { +model <- sdts_train(tr_data, tr_label, w, verbose = 0) +predict <- sdts_predict(model, te_data, round(mean(w))) +sdts_score(predict, te_label, 1)
#> $f_score +#> [1] 0.125 +#> +#> $precision +#> [1] 0.06666667 +#> +#> $recall +#> [1] 1 +#>
# NOT RUN { windows <- c(110, 220, 330) model <- sdts_train(mp_test_data$train$data, mp_test_data$train$label, windows) predict <- sdts_predict(model, mp_test_data$test$data, round(mean(windows))) diff --git a/docs/reference/sdts_train.html b/docs/reference/sdts_train.html index 29140a9..e048b45 100644 --- a/docs/reference/sdts_train.html +++ b/docs/reference/sdts_train.html @@ -69,7 +69,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 @@ -205,7 +205,17 @@

Examp tr_label <- mp_test_data$train$label[subs] te_data <- mp_test_data$test$data[subs] te_label <- mp_test_data$test$label[subs] -model <- sdts_train(tr_data, tr_label, w, verbose = 0)
#> Error in { work_len <- length(idx_work[[i]]) pro_muls <- matrix(Inf, matrix_profile_size, 1) pro_idxs <- matrix(-1, matrix_profile_size, 1) if (length(args) > 1) { pro_muls_right <- pro_muls_left <- NULL pro_idxs_right <- pro_idxs_left <- NULL } else { pro_muls_right <- pro_muls_left <- pro_muls pro_idxs_right <- pro_idxs_left <- pro_idxs } dist_pro <- matrix(0, matrix_profile_size, 1) last_product <- matrix(0, matrix_profile_size, 1) drop_value <- matrix(0, 1, 1) for (j in 1:work_len) { idx_st <- idx_work[[i]][1] idx_ed <- idx_work[[i]][work_len] idx <- idx_work[[i]][j] query_window <- as.matrix(query[idx:(idx + window_size - 1), 1]) if (j == 1) { nni <- dist_profile(data, query, nn, index = idx) dist_pro[, 1] <- nni$distance_profile last_product[, 1] <- nni$last_product } else { last_product[2:(data_size - window_size + 1), 1] <- last_product[1:(data_size - window_size), 1] - data[1:(data_size - window_size), 1] * drop_value + data[(window_size + 1):data_size, 1] * query_window[window_size, 1] last_product[1, 1] <- first_product[idx, 1] dist_pro <- 2 * (window_size - (last_product - window_size * nni$par$data_mean * nni$par$query_mean[idx])/(nni$par$data_sd * nni$par$query_sd[idx])) } dist_pro <- Re(sqrt(dist_pro)) drop_value <- query_window[1, 1] if (exclusion_zone > 0) { exc_st <- max(1, idx - exclusion_zone) exc_ed <- min(matrix_profile_size, idx + exclusion_zone) dist_pro[exc_st:exc_ed, 1] <- Inf } dist_pro[nni$par$data_sd < vars()$eps] <- Inf if (skip_location[idx] || any(nni$par$query_sd[idx] < vars()$eps)) { dist_pro[] <- Inf } dist_pro[skip_location] <- Inf if (length(args) == 1) { ind <- (dist_pro[idx:matrix_profile_size] < pro_muls_left[idx:matrix_profile_size]) ind <- c(rep(FALSE, (idx - 1)), ind) pro_muls_left[ind] <- dist_pro[ind] pro_idxs_left[which(ind)] <- idx ind <- (dist_pro[1:idx] < pro_muls_right[1:idx]) ind <- c(ind, rep(FALSE, matrix_profile_size - idx)) pro_muls_right[ind] <- dist_pro[ind] pro_idxs_right[which(ind)] <- idx } ind <- (dist_pro < pro_muls) pro_muls[ind] <- dist_pro[ind] pro_idxs[which(ind)] <- idx } res <- list(pro_muls = pro_muls, pro_idxs = pro_idxs, pro_muls_left = pro_muls_left, pro_idxs_left = pro_idxs_left, pro_muls_right = pro_muls_right, pro_idxs_right = pro_idxs_right) res}: task 2 failed - "NAs are not allowed in subscripted assignments"
predict <- sdts_predict(model, te_data, round(mean(w)))
#> Error in sdts_predict(model, te_data, round(mean(w))): object 'model' not found
sdts_score(predict, te_label, 1)
#> Error in pred_tmp[seq_len(length(pred))] <- pred: incompatible types (from closure to logical) in subassignment type fix
# NOT RUN { +model <- sdts_train(tr_data, tr_label, w, verbose = 0) +predict <- sdts_predict(model, te_data, round(mean(w))) +sdts_score(predict, te_label, 1)
#> $f_score +#> [1] 0.125 +#> +#> $precision +#> [1] 0.06666667 +#> +#> $recall +#> [1] 1 +#>
# NOT RUN { windows <- c(110, 220, 330) model <- sdts_train(mp_test_data$train$data, mp_test_data$train$label, windows) predict <- sdts_predict(model, mp_test_data$test$data, round(mean(windows))) diff --git a/docs/reference/set_data.html b/docs/reference/set_data.html index 9901ae1..40fc6b4 100644 --- a/docs/reference/set_data.html +++ b/docs/reference/set_data.html @@ -65,7 +65,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 diff --git a/docs/reference/simple_fast.html b/docs/reference/simple_fast.html index c433b38..97d0fe4 100644 --- a/docs/reference/simple_fast.html +++ b/docs/reference/simple_fast.html @@ -65,7 +65,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 diff --git a/docs/reference/stamp.html b/docs/reference/stamp.html index 1492857..d8472cf 100644 --- a/docs/reference/stamp.html +++ b/docs/reference/stamp.html @@ -65,7 +65,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 @@ -219,7 +219,7 @@

Examp
mp <- stamp(mp_toy_data$data[1:200, 1], window_size = 30, verbose = 0) # using threads -mp <- stamp_par(mp_toy_data$data[1:200, 1], window_size = 30, verbose = 0)
#> Error in left_matrix_profile[ind] <- batch[[i]]$dp[ind]: NAs are not allowed in subscripted assignments
# NOT RUN { +mp <- stamp_par(mp_toy_data$data[1:200, 1], window_size = 30, verbose = 0)# NOT RUN { ref_data <- mp_toy_data$data[, 1] query_data <- mp_toy_data$data[, 2] # self similarity diff --git a/docs/reference/stomp.html b/docs/reference/stomp.html index c11a3b7..2d976db 100644 --- a/docs/reference/stomp.html +++ b/docs/reference/stomp.html @@ -65,7 +65,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 @@ -202,7 +202,7 @@

Examp
mp <- stomp(mp_toy_data$data[1:200, 1], window_size = 30, verbose = 0) # using threads -mp <- stomp_par(mp_toy_data$data[1:400, 1], window_size = 30, verbose = 0)
#> Error in { work_len <- length(idx_work[[i]]) pro_muls <- matrix(Inf, matrix_profile_size, 1) pro_idxs <- matrix(-1, matrix_profile_size, 1) if (length(args) > 1) { pro_muls_right <- pro_muls_left <- NULL pro_idxs_right <- pro_idxs_left <- NULL } else { pro_muls_right <- pro_muls_left <- pro_muls pro_idxs_right <- pro_idxs_left <- pro_idxs } dist_pro <- matrix(0, matrix_profile_size, 1) last_product <- matrix(0, matrix_profile_size, 1) drop_value <- matrix(0, 1, 1) for (j in 1:work_len) { idx_st <- idx_work[[i]][1] idx_ed <- idx_work[[i]][work_len] idx <- idx_work[[i]][j] query_window <- as.matrix(query[idx:(idx + window_size - 1), 1]) if (j == 1) { nni <- dist_profile(data, query, nn, index = idx) dist_pro[, 1] <- nni$distance_profile last_product[, 1] <- nni$last_product } else { last_product[2:(data_size - window_size + 1), 1] <- last_product[1:(data_size - window_size), 1] - data[1:(data_size - window_size), 1] * drop_value + data[(window_size + 1):data_size, 1] * query_window[window_size, 1] last_product[1, 1] <- first_product[idx, 1] dist_pro <- 2 * (window_size - (last_product - window_size * nni$par$data_mean * nni$par$query_mean[idx])/(nni$par$data_sd * nni$par$query_sd[idx])) } dist_pro <- Re(sqrt(dist_pro)) drop_value <- query_window[1, 1] if (exclusion_zone > 0) { exc_st <- max(1, idx - exclusion_zone) exc_ed <- min(matrix_profile_size, idx + exclusion_zone) dist_pro[exc_st:exc_ed, 1] <- Inf } dist_pro[nni$par$data_sd < vars()$eps] <- Inf if (skip_location[idx] || any(nni$par$query_sd[idx] < vars()$eps)) { dist_pro[] <- Inf } dist_pro[skip_location] <- Inf if (length(args) == 1) { ind <- (dist_pro[idx:matrix_profile_size] < pro_muls_left[idx:matrix_profile_size]) ind <- c(rep(FALSE, (idx - 1)), ind) pro_muls_left[ind] <- dist_pro[ind] pro_idxs_left[which(ind)] <- idx ind <- (dist_pro[1:idx] < pro_muls_right[1:idx]) ind <- c(ind, rep(FALSE, matrix_profile_size - idx)) pro_muls_right[ind] <- dist_pro[ind] pro_idxs_right[which(ind)] <- idx } ind <- (dist_pro < pro_muls) pro_muls[ind] <- dist_pro[ind] pro_idxs[which(ind)] <- idx } res <- list(pro_muls = pro_muls, pro_idxs = pro_idxs, pro_muls_left = pro_muls_left, pro_idxs_left = pro_idxs_left, pro_muls_right = pro_muls_right, pro_idxs_right = pro_idxs_right) res}: task 1 failed - "NAs are not allowed in subscripted assignments"
# NOT RUN { +mp <- stomp_par(mp_toy_data$data[1:400, 1], window_size = 30, verbose = 0)# NOT RUN { ref_data <- mp_toy_data$data[, 1] query_data <- mp_toy_data$data[, 2] # self similarity diff --git a/docs/reference/stompi_update.html b/docs/reference/stompi_update.html new file mode 100644 index 0000000..c080f68 --- /dev/null +++ b/docs/reference/stompi_update.html @@ -0,0 +1,191 @@ + + + + + + + + +Real-time STOMP algorithm — stompi_update • tsmp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
+ +

Real-time STOMP algorithm

+ +
+ +
stompi_update(.mp, new_data, history_size = FALSE)
+ +

Arguments

+ + + + + + + + + + + + + + +
.mp

a TSMP object of class MatrixProfile.

new_data

new data to append to original data.

history_size

an int or FALSE. (Default is FALSE). Keep only this amount of data in +the object. The value is for the data, not the matrix profile. Notice that the lmpand lpi will +be inconsistent when repeatedly updating limiting the history size and thus will affect +the mp and pi.

+ +

Value

+ +

Returns the input .mp updated with the new information.

+ + +

Examples

+
mp <- tsmp(mp_toy_data$data[1:200, 1], window_size = 30, verbose = 0) +mpi <- stompi_update(mp, mp_toy_data$data[201:300, 1]) +mp <- tsmp(mp_toy_data$data[1:300, 1], window_size = 30, verbose = 0) +all.equal(mp, mpi, check.attributes = FALSE)
#> [1] TRUE
+
+ +
+ +
+ + +
+

Site built with pkgdown 1.3.0.

+
+
+
+ + + + + + diff --git a/docs/reference/tsmp-deprecated.html b/docs/reference/tsmp-deprecated.html index c1af687..03e6f2b 100644 --- a/docs/reference/tsmp-deprecated.html +++ b/docs/reference/tsmp-deprecated.html @@ -68,7 +68,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 diff --git a/docs/reference/tsmp.html b/docs/reference/tsmp.html index ace56e4..a3a3aa0 100644 --- a/docs/reference/tsmp.html +++ b/docs/reference/tsmp.html @@ -66,7 +66,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016 @@ -132,7 +132,7 @@

Computes the Matrix Profile and Profile Index

tsmp(..., window_size, exclusion_zone = 1/2, mode = c("stomp", "stamp",
   "simple", "mstomp", "scrimp", "valmod"), verbose = 2, n_workers = 1,
   s_size = Inf, must_dim = NULL, exc_dim = NULL, heap_size = 50,
-  .keep_data = TRUE)
+ paa = 1, .keep_data = TRUE)

Arguments

@@ -183,6 +183,10 @@

Arg

+ + + + @@ -279,7 +283,8 @@

Examp mp <- tsmp(mp_toy_data$data[1:200, 1], window_size = 30, verbose = 0) # parallel with [stomp_par()] -mp <- tsmp(mp_test_data$train$data[1:1000, 1], window_size = 30, n_workers = 2, verbose = 0)
#> Error in { work_len <- length(idx_work[[i]]) pro_muls <- matrix(Inf, matrix_profile_size, 1) pro_idxs <- matrix(-1, matrix_profile_size, 1) if (length(args) > 1) { pro_muls_right <- pro_muls_left <- NULL pro_idxs_right <- pro_idxs_left <- NULL } else { pro_muls_right <- pro_muls_left <- pro_muls pro_idxs_right <- pro_idxs_left <- pro_idxs } dist_pro <- matrix(0, matrix_profile_size, 1) last_product <- matrix(0, matrix_profile_size, 1) drop_value <- matrix(0, 1, 1) for (j in 1:work_len) { idx_st <- idx_work[[i]][1] idx_ed <- idx_work[[i]][work_len] idx <- idx_work[[i]][j] query_window <- as.matrix(query[idx:(idx + window_size - 1), 1]) if (j == 1) { nni <- dist_profile(data, query, nn, index = idx) dist_pro[, 1] <- nni$distance_profile last_product[, 1] <- nni$last_product } else { last_product[2:(data_size - window_size + 1), 1] <- last_product[1:(data_size - window_size), 1] - data[1:(data_size - window_size), 1] * drop_value + data[(window_size + 1):data_size, 1] * query_window[window_size, 1] last_product[1, 1] <- first_product[idx, 1] dist_pro <- 2 * (window_size - (last_product - window_size * nni$par$data_mean * nni$par$query_mean[idx])/(nni$par$data_sd * nni$par$query_sd[idx])) } dist_pro <- Re(sqrt(dist_pro)) drop_value <- query_window[1, 1] if (exclusion_zone > 0) { exc_st <- max(1, idx - exclusion_zone) exc_ed <- min(matrix_profile_size, idx + exclusion_zone) dist_pro[exc_st:exc_ed, 1] <- Inf } dist_pro[nni$par$data_sd < vars()$eps] <- Inf if (skip_location[idx] || any(nni$par$query_sd[idx] < vars()$eps)) { dist_pro[] <- Inf } dist_pro[skip_location] <- Inf if (length(args) == 1) { ind <- (dist_pro[idx:matrix_profile_size] < pro_muls_left[idx:matrix_profile_size]) ind <- c(rep(FALSE, (idx - 1)), ind) pro_muls_left[ind] <- dist_pro[ind] pro_idxs_left[which(ind)] <- idx ind <- (dist_pro[1:idx] < pro_muls_right[1:idx]) ind <- c(ind, rep(FALSE, matrix_profile_size - idx)) pro_muls_right[ind] <- dist_pro[ind] pro_idxs_right[which(ind)] <- idx } ind <- (dist_pro < pro_muls) pro_muls[ind] <- dist_pro[ind] pro_idxs[which(ind)] <- idx } res <- list(pro_muls = pro_muls, pro_idxs = pro_idxs, pro_muls_left = pro_muls_left, pro_idxs_left = pro_idxs_left, pro_muls_right = pro_muls_right, pro_idxs_right = pro_idxs_right) res}: task 1 failed - "NAs are not allowed in subscripted assignments"
+mp <- tsmp(mp_test_data$train$data[1:1000, 1], window_size = 30, n_workers = 2, verbose = 0) + # Anytime STAMP mp <- tsmp(mp_toy_data$data[1:200, 1], window_size = 30, mode = "stamp", s_size = 50, verbose = 0) diff --git a/docs/reference/valmod.html b/docs/reference/valmod.html index a7da92a..85664bc 100644 --- a/docs/reference/valmod.html +++ b/docs/reference/valmod.html @@ -65,7 +65,7 @@ tsmp - 0.3.4.9005 + 0.3.5.9016
@@ -198,7 +198,7 @@

See a

Examples

-
mp <- valmod(mp_toy_data$data[1:200, 1], window_min = 30, window_max = 40)
#> max_number_motifs_found 133
#> min_number_motifs_found 2
#> Finished in 0.12 secs
# NOT RUN { +
mp <- valmod(mp_toy_data$data[1:200, 1], window_min = 30, window_max = 40)
#> max_number_motifs_found 133
#> min_number_motifs_found 2
#> Finished in 0.15 secs
# NOT RUN { ref_data <- mp_toy_data$data[, 1] query_data <- mp_toy_data$data[, 2] # self similarity diff --git a/inst/WORDLIST b/inst/WORDLIST index b779f21..b1a3b5c 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -65,6 +65,7 @@ MatrixProfile MDL MDS MOTIFs +MPdist mSTAMP mSTOMP MSTOMP diff --git a/man/dist_profile.Rd b/man/dist_profile.Rd index 7173ded..6fbff9b 100644 --- a/man/dist_profile.Rd +++ b/man/dist_profile.Rd @@ -72,7 +72,8 @@ for (i in seq_len(10)) { # weighted weight <- c(rep(1, w / 3), rep(0.5, w / 3), rep(0.8, w / 3)) # just an example -nn <- dist_profile(ref_data, ref_data, window_size = w, index = 1, method = "weighted", weight = weight) +nn <- dist_profile(ref_data, ref_data, window_size = w, index = 1, method = "weighted", + weight = weight) distance_profile <- Re(sqrt(nn$distance_profile)) } \references{ diff --git a/man/mass-deprecated.Rd b/man/mass-deprecated.Rd index e3b1f96..2de3da8 100644 --- a/man/mass-deprecated.Rd +++ b/man/mass-deprecated.Rd @@ -4,7 +4,8 @@ \alias{mass-deprecated} \title{Calculates the distance profile using MASS_V2 algorithm} \usage{ -mass(data_fft, query_window, data_size, window_size, data_mean, data_sd, query_mean, query_sd) +mass(data_fft, query_window, data_size, window_size, data_mean, data_sd, + query_mean, query_sd) } \arguments{ \item{data_fft}{precomputed data product.} diff --git a/man/mass_pre_w.Rd b/man/mass_pre_w.Rd index c1905da..0eda570 100644 --- a/man/mass_pre_w.Rd +++ b/man/mass_pre_w.Rd @@ -25,7 +25,8 @@ Precomputes several values used on MASS w <- mp_toy_data$sub_len ref_data <- mp_toy_data$data[, 1] query_data <- mp_toy_data$data[, 1] -weight <- c(rep(1, mp_toy_data$sub_len / 3), rep(0.5, mp_toy_data$sub_len / 3), rep(1, mp_toy_data$sub_len / 3)) +weight <- c(rep(1, mp_toy_data$sub_len / 3), rep(0.5, mp_toy_data$sub_len / 3), +rep(1, mp_toy_data$sub_len / 3)) pre <- tsmp:::mass_pre_w(ref_data, query_data, w, weight) diff --git a/man/mass_weighted.Rd b/man/mass_weighted.Rd index 01f48d0..711ece9 100644 --- a/man/mass_weighted.Rd +++ b/man/mass_weighted.Rd @@ -38,7 +38,8 @@ Series Subsequences under Euclidean Distance and Correlation Coefficient. w <- mp_toy_data$sub_len ref_data <- mp_toy_data$data[, 1] query_data <- mp_toy_data$data[, 1] -weight <- c(rep(1, mp_toy_data$sub_len / 3), rep(0.5, mp_toy_data$sub_len / 3), rep(1, mp_toy_data$sub_len / 3)) +weight <- c(rep(1, mp_toy_data$sub_len / 3), rep(0.5, mp_toy_data$sub_len / 3), + rep(1, mp_toy_data$sub_len / 3)) pre <- tsmp:::mass_pre_w(ref_data, query_data, w, weight) diff --git a/man/plot_arcs.Rd b/man/plot_arcs.Rd index 0d09a04..5488d8e 100644 --- a/man/plot_arcs.Rd +++ b/man/plot_arcs.Rd @@ -27,6 +27,10 @@ arc, respectively. Accepts one color.} \item{xlab}{a \code{string}. (Default is \code{"Profile Index"}). X label.} +\item{xmin}{an \code{int}. (Default is \code{NULL}). Set the minimum value of x axis.} + +\item{xmax}{an \code{int}. (Default is \code{NULL}). Set the maximum value of x axis.} + \item{...}{further arguments to be passed to \code{\link[=plot]{plot()}}. See \code{\link[=par]{par()}}.} } \value{ diff --git a/man/tsmp.Rd b/man/tsmp.Rd index d27a10f..df25e75 100644 --- a/man/tsmp.Rd +++ b/man/tsmp.Rd @@ -36,6 +36,8 @@ details.} \item{heap_size}{an \code{int}. (Default is \code{50}). Size of the distance profile heap buffer.} +\item{paa}{an \code{int}. (Default is \code{1}). Factor of PAA reduction (2 == half of size)} + \item{.keep_data}{a \code{logical}. (Default is \code{TRUE}). Keeps the data embedded to resultant object.} } \value{ diff --git a/tests/testthat/test-subset.R b/tests/testthat/test-subset.R index 400c2d2..3bc3ef3 100644 --- a/tests/testthat/test-subset.R +++ b/tests/testthat/test-subset.R @@ -6,7 +6,7 @@ if (skip_on_cran()) { w <- mp_fluss_data$tilt_abp$window nseg <- 1 offset <- 4000 - test_mp <- tsmp(data, window_size = w, n_workers = 6) + test_mp <- tsmp(data, window_size = w, n_workers = 2) cac <- fluss_cac(test_mp) segments <- fluss_extract(cac, nseg) @@ -27,13 +27,13 @@ if (skip_on_cran()) { }) test_that("Head Chain", { - h_chain <- head(chain, 8000) + h_chain <- utils::head(chain, 8000) expect_equal(sum(h_chain$chain$best), 39574) expect_equal(length(h_chain$chain$best), 6) }) test_that("Tail Chain", { - t_chain <- tail(chain, 4000) + t_chain <- utils::tail(chain, 4000) expect_equal(sum(t_chain$chain$best), 14625) expect_equal(length(t_chain$chain$best), 9) }) @@ -46,7 +46,7 @@ if (skip_on_cran()) { }) test_that("Head Arc Count", { - h_cac <- head(cac, offset) + h_cac <- utils::head(cac, offset) expect_equal(round(mean(h_cac$cac), 4), 0.7198) expect_equal(round(sd(h_cac$cac), 3), 0.316) expect_equal(round(min(h_cac$cac), 3), 0.209) @@ -54,7 +54,7 @@ if (skip_on_cran()) { }) test_that("Tail Arc Count", { - t_cac <- tail(cac, offset) + t_cac <- utils::tail(cac, offset) expect_equal(round(mean(t_cac$cac), 4), 0.7654) expect_equal(round(sd(t_cac$cac), 3), 0.273) expect_equal(round(min(t_cac$cac), 3), 0.255) @@ -66,12 +66,12 @@ if (skip_on_cran()) { }) test_that("Head Segments found", { - h_segment <- head(segments, offset) + h_segment <- utils::head(segments, offset) expect_equal(h_segment$fluss, 1228) }) test_that("Tail Segments found", { - t_segment <- tail(segments, offset) + t_segment <- utils::tail(segments, offset) expect_equal(t_segment$fluss, 1643) }) }
heap_size

an int. (Default is 50). Size of the distance profile heap buffer.

paa

an int. (Default is 1). Factor of PAA reduction (2 == half of size)

.keep_data

a logical. (Default is TRUE). Keeps the data embedded to resultant object.