
Binary classification by thresholding a logistic score (Geron Ch 3, hmbin)
Source:R/geron_ml_native.R
morie_geron_binary_classification.Rdp_hat = sigmoid(X theta) computed branch-free (exp only on <= 0), then y_pred = 1[p_hat >= threshold].
Value
List with y_pred, p_hat, logit and, when y_true is
given, tp, fp, fn, tn, accuracy, precision, recall, f1.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_geron_binary_classification(V, V)
#> $y_pred
#> [1] 1
#>
#> $p_hat
#> [1] 1
#>
#> $logit
#> [1] 204
#>
#> $threshold
#> [1] 0.5
#>
#> $tp
#> NULL
#>
#> $fp
#> NULL
#>
#> $fn
#> NULL
#>
#> $tn
#> NULL
#>
#> $accuracy
#> NULL
#>
#> $precision
#> NULL
#>
#> $recall
#> NULL
#>
#> $f1
#> NULL
#>
#> $estimate
#> [1] 1
#>
#> $n
#> [1] 1
#>
#> $method
#> [1] "Binary classification by thresholding the logistic score"
#>