diff --git a/NAMESPACE b/NAMESPACE index 5783f4b..1886c14 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,8 @@ # Generated by roxygen2: do not edit by hand S3method(plot,edObject) +S3method(predict,NeuralNetwork) +S3method(predict,UnivariateForecast) S3method(print,edObject) export(buildEDModel) export(detectEvents) diff --git a/R/detectEvents.R b/R/detectEvents.R index 44ef714..182501d 100644 --- a/R/detectEvents.R +++ b/R/detectEvents.R @@ -168,7 +168,7 @@ if(length(eventPositions>0)) } model_name <- function(x, ...){ - sub("forecast_", "", class(x)[1]) + sub("forecast_", "", tail(class(x),1)) } #' Print an Event Detection Object diff --git a/R/model_Forecast.R b/R/model_Forecast.R index 174a6b7..36069ae 100644 --- a/R/model_Forecast.R +++ b/R/model_Forecast.R @@ -62,6 +62,7 @@ model_UnivariateForecast <- function(x, strName, control){ #' @return predicted value #' @import stats #' @keywords internal +#' @exportS3Method predict UnivariateForecast predict.UnivariateForecast <- function(object,newData = NULL, ...){ ## How many points shall be predicted into the future? Default = 10 if(!is.null(newData)){ diff --git a/R/model_NeuralNetwork.R b/R/model_NeuralNetwork.R index c84385c..1f6ea65 100644 --- a/R/model_NeuralNetwork.R +++ b/R/model_NeuralNetwork.R @@ -58,7 +58,7 @@ control$threshold <- NULL #' - +#' @exportS3Method predict NeuralNetwork predict.NeuralNetwork <- function(object,newData = NULL, ...){ ## How many points shall be predicted into the future? Default = 10 if(!is.null(newData)){ diff --git a/tests/testthat/test-eventClassification.R b/tests/testthat/test-eventClassification.R index 8db9afd..67a39e5 100644 --- a/tests/testthat/test-eventClassification.R +++ b/tests/testthat/test-eventClassification.R @@ -51,11 +51,11 @@ test_that("print works", buildModelAlgo = "ForecastArima") printRes <- capture.output(print(ed)) - expect_equal(printRes[1], "Event Detection Object with 11 ARIMA submodels") + expect_equal(printRes[1], "Event Detection Object with 11 Arima submodels") ed$modelList <- ed$modelList[1] printRes <- capture.output(print(ed)) - expect_equal(printRes[1], "Event Detection Object with 1 ARIMA submodel") + expect_equal(printRes[1], "Event Detection Object with 1 Arima submodel") ed$modelList <- NULL printRes <- capture.output(print(ed)) @@ -89,5 +89,3 @@ test_that("neural network prediction works", }) - -