L2 <- function(y, yhat, w){
n <- length(y)
if (missing(w)) w <- rep(1 / n, n)
return(stats::weighted.mean((y-yhat)^2, w))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.