madPlot: Mean Absolute Deviation Plot

View source: R/madPlot.R

madPlotR Documentation

Mean Absolute Deviation Plot

Description

Function to create Mean Absolute Deviation Plot

Usage

madPlot(hvt.prediction, ...)

Arguments

hvt.prediction

List. A list of hvt.prediction obtained from the predictHVT function.

...

The ellipsis is passed to it as additional argument. (Used internally)

Details

This function plots percentage anomalies vs mean absolute deviation for test data. The plot helps in deciding an optimal MAD value for the use case.

Value

Mean Absolute Deviation Plot

mad_plot

ggplot plot. A plot with percentage anomalies on y axis and mean absolute deviation values on xaxis.

Author(s)

Shubhra Prakash <shubhra.prakash@mu-sigma.com>

See Also

predictHVT

Examples

data(USArrests)
#Split in train and test

train <- USArrests[1:40,]
test <- USArrests[41:50,]

hvt.results <- list()
hvt.results <- HVT(train, nclust = 15, depth = 1, quant.err = 0.2,
                   distance_metric = "L1_Norm", error_metric = "mean",
                   projection.scale = 10, normalize = TRUE,
                   quant_method="kmeans",diagnose=TRUE)

predictions <- predictHVT(test,hvt.results, child.level=2,mad.threshold = 0.2)
print(predictions$scoredPredictedData)
madPlot(hvt.prediction=predictions)

muHVT documentation built on April 27, 2022, 5:07 p.m.