
Logistic thresholded prediction (Geron Ch 4, morie.fn grn016)
Source:R/geron_train_native.R
morie_geron_ch4_logistic_regression_prediction.Rdy_hat = 1 iff p_hat >= threshold; the boundary goes positive.
Examples
morie_geron_ch4_logistic_regression_prediction(c(0.2, 0.5, 0.9),
0.5)
#> $y_hat
#> [1] 0 1 1
#>
#> $positive_rate
#> [1] 0.6666667
#>
#> $margin
#> [1] -0.3 0.0 0.4
#>
#> $threshold
#> [1] 0.5
#>
#> $estimate
#> [1] 0 1 1
#>
#> $n
#> [1] 3
#>