1 2 3 4 5 6 | r.optimize.threshold(score, target, f_obj = function(threshold) { predict
= numeric(length(score)) predict[score > threshold] = 1 t <-
table(predict, target) if (nrow(t) == 1) f1 = 0 else f1 = 0.5
* (2 * t[1, 1]/(2 * t[1, 1] + t[1, 2] + t[2, 1])) + 0.5 * (2 * t[2, 2]/(2 *
t[2, 2] + t[1, 2] + t[2, 1])) return(-f1) }, x0 = quantile(score, probs
= 0.5), xtol_rel = 1e-08, maxtime = 60, algorithm = "NLOPT_LN_COBYLA")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.