Learn R Programming

muHVT (version 3.0.0)

madPlot: Mean Absolute Deviation Plot

Description

Function to create Mean Absolute Deviation Plot

Usage

madPlot(hvt.prediction, ...)

Value

Mean Absolute Deviation Plot

mad_plot

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

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)

Author

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

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.

See Also

predictHVT

Examples

Run this code
data(USArrests)
#Split in train and test

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

hvt.results <- list()
hvt.results <- HVT(train, n_cells = 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)

Run the code above in your browser using DataLab