madPlot {HVT} | R Documentation |
Function to create Mean Absolute Deviation Plot
madPlot(hvt.prediction, ...)
hvt.prediction |
List. A list of hvt.prediction obtained from the predictHVT function. |
... |
The ellipsis is passed to it as additional argument. (Used internally) |
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.
Mean Absolute Deviation Plot
mad_plot |
ggplot plot. A plot with percentage anomalies on y axis and mean absolute deviation values on xaxis. |
Shubhra Prakash <shubhra.prakash@mu-sigma.com>
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)