# This file was generated by Rcpp::compileAttributes
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Compute indeces of anomalies in SAX series based on Window Comparison Anomaly Detection Algorithm
#' @title Window Comparison Anomaly Detection (WCAD)
#' @param data A vector containing the SAX series to be tested for anomalies
#' @param windowNum The inital number of windows to start off with (The number of pieces we split the original SAX series into)
#' @param cdmThreshold The minimum a CDM value can be to be considered "interesting" or containing an anomaly
#' @return An unordered NumericVector containing the indices of the detected anomalies
WCAD <- function(data, windowNum, cdmThreshold) {
.Call('rsax_WCAD', PACKAGE = 'rsax', data, windowNum, cdmThreshold)
}
#' Compute the centroids of a matrix of SAX data using kMedians.
#' @title kMedian Centroids (runKMedian)
#' @param seq A matrix of SAX data to be used for computation of centroids. Each row representing a new/seperate piece of data from the same system.
#' @param card A matrix of cardinality values for the SAX data. This should have the same dimensions as the paraketer 'seq'.
#' @param step The size of the distance between indices of sampling of the SAX data.
#' @param windowSize The size of each sample from the SAX data. Also the number of elements in each centroid.
#' @param clusterNum The number of centroids generated.
#' @param centroidSeq A matrix of centroids only used for computation if 'prevCentroid' parameter is true.
#' @param centroidCard A matrix of cardinalities of centroids only used for computation if 'prevCentroid' parameter is true.
#' @param prevCentroid False: Do not use inputted centroids in computation. True: Use inputted centroids in computation.
#' @return A list of lists of computed centroids and their cardinalities.
runKMedian <- function(seq, card, step, windowSize, clusterNum, centroidSeq, centroidCard, prevCentroid = FALSE) {
.Call('rsax_runKMedian', PACKAGE = 'rsax', seq, card, step, windowSize, clusterNum, centroidSeq, centroidCard, prevCentroid)
}
#' Reconstruct a sequence of SAX data using centroids trained using 'runKMedian' function and compute the difference vector between the original and reconstructed data.
#' @title Reconstruct Data (reconstruct)
#' @param seq A vector of SAX data to be reconstructed using centroids.
#' @param card A vector of cardinality values for the SAX data.
#' @param step The size of the distance between indices of sampling of the SAX data.
#' @param centroidList A list of lists of centroids and their cardinalities. Computed from 'runKMedian' function.
#' @return A list containing a vector storing the reconstructed data and a vector storing the difference vector between the original and reconstructed data.
reconstruct <- function(seq, card, step, centroidList) {
.Call('rsax_reconstruct', PACKAGE = 'rsax', seq, card, step, centroidList)
}
#' Compute the euclidean distance between two sets of time series data.
#' @title Euclidean Distance (eucDis)
#' @param rawData1 A vector containing the first of the two sets of time series data.
#' @param rawData2 A vector containing the second of the two sets of time series data.
#' @return The euclidean distance between the two sets of time series data as a float.
eucDis <- function(rawData1, rawData2) {
.Call('rsax_eucDis', PACKAGE = 'rsax', rawData1, rawData2)
}
#' Compute the minimum distance between two sets of SAX data.
#' @title Minimum Distance (minDis)
#' @param SaxData1 A vector containing the first of two sets of SAX data for minimum distance computation.
#' @param card1 A vector containing the first of two sets of cardinality data for the SAX data.
#' @param SaxData2 A vector containing the second of two sets of SAX data for minimum distance computation.
#' @param card2 A vector containing the second of two sets of cardinality data for the SAX data.
#' @param rawDataSize The size of the time series data before conversion to SAX data. The size of each time series data should be the same for both SAX data sets.
#' @param suppressWarnings Supress any warnings created by the user. Not any warnings created by the compiler
#' @return The minimum distance between the two SAX data sets as a float
minDis <- function(SAXData1, card1, SAXData2, card2, rawDataSize, suppressWarnings = FALSE) {
.Call('rsax_minDis', PACKAGE = 'rsax', SAXData1, card1, SAXData2, card2, rawDataSize, suppressWarnings)
}
#' Convert a time series into a SAX Word.
#' @title Convert to SAX (runSAX)
#' @param orgData A vector of time series data to be converted to a SAX Word.
#' @param segmentSize The size of each segment taken when converting to SAX Word.
#' @param alphabetSize The size of the alphabet for classification of PAAs to SAX Words.
#' @param iSAX False: returns only the SAX Word. True: returns SAX Word and Cardinality.
#' @return A Vector that contains the SAX Word and if iSAX = true a Vector that contains its corresponding Cardinality.
runSAX <- function(orgData, segmentSize, alphabetSize, iSAX = FALSE) {
.Call('rsax_runSAX', PACKAGE = 'rsax', orgData, segmentSize, alphabetSize, iSAX)
}
runNormData <- function(data) {
.Call('rsax_runNormData', PACKAGE = 'rsax', data)
}
runToPAA <- function(data, segSize) {
.Call('rsax_runToPAA', PACKAGE = 'rsax', data, segSize)
}
runToSAX <- function(data, brkPtNum) {
.Call('rsax_runToSAX', PACKAGE = 'rsax', data, brkPtNum)
}
ttt <- function(data) {
invisible(.Call('rsax_ttt', PACKAGE = 'rsax', data))
}
testFunc <- function(mtx) {
invisible(.Call('rsax_testFunc', PACKAGE = 'rsax', mtx))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.