
Multilabel thresholded prediction (Geron Ch 3, morie.fn grmlb)
Source:R/geron_train_native.R
morie_geron_multilabel_classification.RdStrict > thresholding per label; per-label F1 via
morie_geron_f1_score(), plus the micro F1 over pooled counts.
Value
List with predictions, per_label_f1,
per_label_precision, per_label_recall, macro_f1, micro_f1,
exact_match_ratio, hamming_loss.
Examples
x <- matrix(c(1, 0, 0.5, 1), 2, byrow = TRUE)
morie_geron_encoder_decoder_seq2seq(function(x) c(sum(x), 1),
function(yp, cc, t) as.numeric(yp) * 0.5 + cc[1]/t, c(1,
2, 3), 4)
#> $outputs
#> $outputs[[1]]
#> [1] 6 6
#>
#> $outputs[[2]]
#> [1] 6 6
#>
#> $outputs[[3]]
#> [1] 5 5
#>
#> $outputs[[4]]
#> [1] 4 4
#>
#>
#> $context
#> [1] 6 1
#>
#> $context_dim
#> [1] 2
#>
#> $n_steps
#> [1] 4
#>
#> $stopped_early
#> [1] FALSE
#>
#> $estimate
#> $estimate[[1]]
#> [1] 6 6
#>
#> $estimate[[2]]
#> [1] 6 6
#>
#> $estimate[[3]]
#> [1] 5 5
#>
#> $estimate[[4]]
#> [1] 4 4
#>
#>
#> $n
#> [1] 4
#>
morie_geron_multilabel_classification(X = x, Y = x)
#> $predictions
#> [,1] [,2]
#> [1,] 1 0
#> [2,] 0 1
#>
#> $per_label_f1
#> [1] 1 1
#>
#> $per_label_precision
#> [1] 1 1
#>
#> $per_label_recall
#> [1] 1 1
#>
#> $macro_f1
#> [1] 1
#>
#> $micro_f1
#> [1] 1
#>
#> $exact_match_ratio
#> [1] 1
#>
#> $hamming_loss
#> [1] 0
#>
#> $thresholds
#> [1] 0.5 0.5
#>
#> $estimate
#> [1] 1
#>
#> $n
#> [1] 2
#>