我正在尝试评估用于进行某些预测的不同算法的分数。我使用scoring_model
作为函数
scoring_model <- function(observed, predicted) {
if (observed < predicted)
score <- ((exp(-(observed - predicted)/10)) -1 )
else if(observed > predicted)
score <- ((exp((observed - predicted)/13)) -1 )
else score <- 0
metrics_score <- c("Score" = score)
return(metrics_score)
}
运行此代码后,我收到错误
##Warning message:
##In if (observed < predicted) score <- ((exp(-(observed - predicted)/10)) - :
##the condition has length > 1 and only the first element will be used