#' Compute the probability that two functions yield the same predictions given an acceptable difference in the prediction
#'
#'
#' Compute the probability that the two functions yield the same predictions given an acceptable difference in the prediction.
#'
#' @param predicted_by_first A numeric vector specifying the values predicted by first function
#' @param predicted_by_second A numeric vector specifying the values predicted by second function
#' @param threshold A numeric vector of lenght one specifying the "acceptable difference in the predicted values"
#' @export
compareFunctions <- function(predicted_by_first, predicted_by_second, threshold) {
diff <- abs(predicted_by_first - predicted_by_second)
boolean <- diff<threshold
acceptCount <- length(boolean[boolean==TRUE]) # counts the TRUE
probability <- acceptCount/length(diff)
return(probability)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.