Skip to content

Commit

Permalink
predict for DSC now honors the formula in the DSC. Updated man pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
mhahsler committed Apr 19, 2024
1 parent 3ee6904 commit 7e63067
Show file tree
Hide file tree
Showing 65 changed files with 191 additions and 84 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ Authors@R: c(person("Michael", "Hahsler", role = c("aut", "cre", "cph"),
person("Dalibor", "Krleža", role = c("ctb"))
)
Description: A framework for data stream modeling and associated data mining tasks such as clustering and classification. The development of this package was supported in part by NSF IIS-0948893, NSF CMMI 1728612, and NIH R21HG005912. Hahsler et al (2017) <doi:10.18637/jss.v076.i14>.
Depends: R (>= 3.5.0), methods, proxy (>= 0.4-7), magrittr
Imports: clue, cluster, clusterGeneration, dbscan (>= 1.0-0), fpc, graphics, grDevices, MASS, mlbench, rpart, Rcpp (>= 0.11.4), stats, utils
Depends: R (>= 3.5.0), methods, magrittr
Imports: clue, cluster, clusterGeneration, dbscan (>= 1.0-0), fpc, graphics, grDevices, MASS, mlbench, rpart, Rcpp (>= 0.11.4), stats, utils, proxy (>= 0.4-7)
Suggests: animation, DBI, dplyr, rJava, RSQLite, testthat, knitr
URL: https://github.com/mhahsler/stream
BugReports: https://github.com/mhahsler/stream/issues
LinkingTo: Rcpp, BH
License: GPL-3
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ S3method(update,DSF)
S3method(update,DSF_Convolve)
S3method(update,DSF_Downsample)
S3method(update,DSF_ExponentialMA)
S3method(update,DSF_FeatureSelection)
S3method(update,DSF_Func)
S3method(update,DSF_Scale)
S3method(update,DSF_dplyr)
Expand Down Expand Up @@ -164,6 +165,7 @@ export(DSFP)
export(DSF_Convolve)
export(DSF_Downsample)
export(DSF_ExponentialMA)
export(DSF_FeatureSelection)
export(DSF_Func)
export(DSF_Scale)
export(DSF_dplyr)
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# stream 2.0-2 (xx/xx/23)

## New Features
* Added DSF_FeatureSelection.

## Bugfix
* Fixed exports for get_macroclusters.DSC_DStream, get_macroweights.DSC_DStream
and recluster.DSC
* predict for DSC now honors the formula in the DSC.

## Changes
* Improved manual pages
* proxy is now imported and not attached globally.

# stream 2.0-1 (02/28/23)

Expand Down
17 changes: 17 additions & 0 deletions R/DSC_DBSTREAM.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@
#'
#' update(dbstream, stream, 500)
#' get_centers(dbstream)
#'
#' # use DBSTREAM for outlier detection
#' stream <- DSD_Gaussians(k = 3, d = 4, noise = 0.05)
#' outlier_detector <- DSOutlier_DBSTREAM(r = .2)
#'
#' update(outlier_detector, stream, 500)
#' outlier_detector
#'
#' plot(outlier_detector, stream)
#'
#' points <- get_points(stream, 20)
#' points
#' which(is.na(predict(outlier_detector, points)))
#' @export
DSC_DBSTREAM <- function(formula = NULL,
r,
Expand Down Expand Up @@ -548,6 +561,10 @@ get_assignment.DSC_DBSTREAM <- function(dsc,

points <- remove_info(points)

## apply formula
if (!is.null(dsc$RObj$colnames))
points <- points[, dsc$RObj$colnames, drop = FALSE]

if (method == "auto")
method <- "model"
if (method != "model")
Expand Down
4 changes: 4 additions & 0 deletions R/DSC_DStream.R
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,10 @@ get_assignment.DSC_DStream <-

points <- remove_info(points)

## apply formula
if (!is.null(dsc$RObj$colnames))
points <- points[, dsc$RObj$colnames, drop = FALSE]

if (method == "auto")
method <- "model"
if (method != "model")
Expand Down
1 change: 1 addition & 0 deletions R/DSC_R.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ update.DSC_R <- function(object,
for (bl in .make_block(n, block)) {
p <- get_points(dsd, bl, info = FALSE)

## apply formula
if (!is.null(object$formula)) {
if (is.null(object$RObj$colnames)) {
trms <- terms(object$formula, data = p)
Expand Down
4 changes: 4 additions & 0 deletions R/DSC_TwoStage.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ get_assignment.DSC_TwoStage <-
...) {
points <- remove_info(points)

## apply formula
if (!is.null(dsc$RObj$colnames))
points <- points[, dsc$RObj$colnames, drop = FALSE]

type <- match.arg(type)
if (type == "micro") {
dsc$state$newdata <- TRUE
Expand Down
6 changes: 5 additions & 1 deletion R/get_assignment.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ get_assignment.DSC <-
warning("method model not implemented! using Euclidean nearest neighbor instead!")
method <- "nn"
}

points <- remove_info(points)

## apply formula
if (!is.null(dsc$formula) && !is.null(dsc$RObj$colnames))
points <- points[, dsc$RObj$colnames, drop = FALSE]

c <- get_centers(dsc, type = type, ...)

if (nrow(c) > 0L) {
Expand Down
4 changes: 2 additions & 2 deletions man/DSAggregate.Rd

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

4 changes: 2 additions & 2 deletions man/DSAggregate_Sample.Rd

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

4 changes: 2 additions & 2 deletions man/DSAggregate_Window.Rd

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

2 changes: 1 addition & 1 deletion man/DSC.Rd

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

13 changes: 13 additions & 0 deletions man/DSC_DBSTREAM.Rd

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

2 changes: 1 addition & 1 deletion man/DSC_Macro.Rd

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

2 changes: 1 addition & 1 deletion man/DSC_Micro.Rd

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

2 changes: 1 addition & 1 deletion man/DSC_R.Rd

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

2 changes: 1 addition & 1 deletion man/DSC_SlidingWindow.Rd

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

2 changes: 1 addition & 1 deletion man/DSC_Static.Rd

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

2 changes: 1 addition & 1 deletion man/DSC_TwoStage.Rd

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

2 changes: 1 addition & 1 deletion man/DSClassifier.Rd

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

2 changes: 1 addition & 1 deletion man/DSD_BarsAndGaussians.Rd

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

2 changes: 1 addition & 1 deletion man/DSD_Benchmark.Rd

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

2 changes: 1 addition & 1 deletion man/DSD_Cubes.Rd

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

2 changes: 1 addition & 1 deletion man/DSD_Gaussians.Rd

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

2 changes: 1 addition & 1 deletion man/DSD_MG.Rd

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

2 changes: 1 addition & 1 deletion man/DSD_Memory.Rd

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

2 changes: 1 addition & 1 deletion man/DSD_Mixture.Rd

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

Loading

0 comments on commit 7e63067

Please sign in to comment.