powered by
Create a performance metric for use with the MachineShop package.
MLMetric(object, name = "MLMetric", label = name, maximize = TRUE)MLMetric(object) <- value
MLMetric(object) <- value
MLMetric class object.
MLMetric
function to compute the metric, defined to accept observed and predicted as the first two arguments and with an ellipsis (...) to accommodate others.
observed
predicted
...
character name of the object to which the metric is assigned.
optional character descriptor for the model.
logical indicating whether higher values of the metric correspond to better predictive performance.
list of arguments to pass to the MLMetric constructor.
metrics
f2_score <- MLMetric( function(observed, predicted, ...) { f_score(observed, predicted, beta = 2, ...) }, name = "f2_score", label = "F Score (beta = 2)", maximize = TRUE )
Run the code above in your browser using DataLab