I'm trying to implement the FBeta_Score()
of the MLmetrics
R package:
FBeta_Score <- function(y_true, y_pred, positive = NULL, beta = 1) {
Confusion_DF <- ConfusionDF(y_pred, y_true)
if (is.null(positive) == TRUE)
positive <- as.character(Confusion_DF[1,1])
Precision <- Precision(y_true, y_pred, positive)
Recall <- Recall(y_true, y_pred, positive)
Fbeta_Score <- (1 + beta^2) * (Precision * Recall) / (beta^2 * Precision +
Recall)
return(Fbeta_Score)
}
in the H2O distributed random forest model and I want to optimize it during the training phase using the custom_metric_func
option.
The help documentation of the h2o.randomForest()
function says:
Reference to custom evaluation function, format: 'language:keyName=funcName'
But I don't understand how to use it directly from R and what I should specify in the stopping_metric
option.
Any help would be appreciated!