Created
January 12, 2017 21:26
Symmetric MAPE following visualization in Figure 3c of the MAAPE Paper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(ggplot2) | |
A <- seq(0, 10, length=100) | |
F <- seq(0, 10, length=100) | |
symmetric_mape <- function(A, F) { | |
abs(F - A) / (abs(A) + abs(F)) | |
} | |
smape_grid <- tbl_df(expand.grid(A=A, F=F)) %>% | |
mutate(smape=symmetric_mape(A, F)) | |
p <- ggplot(smape_grid, aes(x=A, y=F)) + geom_raster(aes(fill=smape)) | |
p <- p + scale_fill_gradientn(colors=c("#0000FFFF","#FFFFFFFF","#FF0000FF")) | |
p + ggtitle("Visualization of SMAPE in 2D") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment