tidylab / decorators

Extend the behaviour of a function without explicitly modifying it
https://tidylab.github.io/decorators/
Other
12 stars 0 forks source link

base::Vectorize #5

Open harell opened 3 years ago

harell commented 3 years ago
rmse <- function(truth, estimate) sqrt(mean(truth - estimate)^2)
vrmse <- Vectorize(rmse)

set.seed(946)
y = runif(10)
y_hat =runif(10)

rmse(y, y_hat) #  0.12
vrmse(y, y_hat) # 0.33 0.09 0.16 0.46 0.11 0.38 0.51 0.73 0.42 0.33