library(cbar, warn.conflicts = F) library(dplyr, warn.conflicts = F) library(ggplot2, warn.conflicts = F)
Either you try stable CRAN version
install.packages("cbar")
Or unstable development version
devtools::install_github("zedoul/cbar")
You'll need to use library
to load as follows:
library(cbar)
cbar
is an R package for detecting anomaly in time-series data with Bayesian inference.
Although there are many packages to detect anomaly in the world, relatively few packages
provide functions for visually and/or analytically abstracting the output.
The cbar
package aims to provide simple-to-use functions for detecting anomaly, and abstracting the analysis output.
A minimal example would be like:
library(cbar) .data <- mtcars rownames(.data) <- NULL datetime <- seq(from = Sys.time(), length.out = nrow(.data), by = "mins") .data <- cbind(datetime = datetime, .data) ref_session <- 1:16 mea_session <- 17:nrow(.data) .cbar <- cbar(.data, ref_session, mea_session) plot_ts(.cbar)
You may wonder why it uses reference
and measurement
instead of training
and testing
. In anomaly detection, espeically in telecommuncation field, performance reference period
refers a period which serves a basis for defining anomaly, and performance measurement period
refers the period during which performance parameters are measured.
If you hope to see the abstracted outcome, then:
summarise_session(.cbar)
or you can just use print
function as follows:
print(.cbar)
or
summarise_session(.cbar)
If you hope to see details of those anomalies:
summarise_anomaly(.cbar, .session = "measurement")
And if you rather want to check prediction performance:
summarise_pred_error(.cbar)
to visualise:
plot_error(.cbar, method = "mape")
This Bayesian algorithm selects the best indicators, so we can make use of those selected indicators for structural analysis. Note that those indicators will be selected during the reference period.
To see those indicators:
summarise_incprob(.cbar)
to visualise:
plot_incprob(.cbar)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.