
Multilabel classification metrics, leave-one-out kNN default (Geron Ch 3, morie.fn hmmlb)
Source:R/geron_w4b_native.R
morie_geron_multilabel.RdMultilabel classification metrics, leave-one-out kNN default (Geron Ch 3, morie.fn hmmlb)
Value
List with Y_pred, subset_accuracy, hamming_loss, jaccard, per_label_f1, macro_f1, zero_baseline_hamming, estimate, n, method.
Examples
loud <- array(1, dim = c(2, 8, 4))
a <- morie_geron_kv_cache_compress(loud, loud, n_bits = 8, per_head = TRUE)
b <- morie_geron_kv_cache_compress(loud, loud, n_bits = 8, per_head = FALSE)
TOOLS <- list(list(name = "add", description = "add two numbers"))
server <- function(req) {
if (req$method == "tools/list")
return(list(jsonrpc = "2.0", id = req$id, result = list(tools = TOOLS)))
if (req$method == "tools/call") {
a <- req$params$arguments$a
b <- req$params$arguments$b
return(list(jsonrpc = "2.0", id = req$id, result = list(content = a +
b)))
}
list(jsonrpc = "2.0", id = req$id, error = list(code = -32601L,
message = "Method not found"))
}
reqs <- list(list(jsonrpc = "2.0", id = 1, method = "tools/list"),
list(jsonrpc = "2.0", id = 2, method = "tools/call", params = list(name = "add",
arguments = list(a = 2, b = 3))))
morie_geron_model_context_protocol(server, reqs)
#> $exchanges
#> $exchanges[[1]]
#> $exchanges[[1]]$request
#> $exchanges[[1]]$request$jsonrpc
#> [1] "2.0"
#>
#> $exchanges[[1]]$request$id
#> [1] 1
#>
#> $exchanges[[1]]$request$method
#> [1] "tools/list"
#>
#>
#> $exchanges[[1]]$response
#> $exchanges[[1]]$response$jsonrpc
#> [1] "2.0"
#>
#> $exchanges[[1]]$response$id
#> [1] 1
#>
#> $exchanges[[1]]$response$result
#> $exchanges[[1]]$response$result$tools
#> $exchanges[[1]]$response$result$tools[[1]]
#> $exchanges[[1]]$response$result$tools[[1]]$name
#> [1] "add"
#>
#> $exchanges[[1]]$response$result$tools[[1]]$description
#> [1] "add two numbers"
#>
#>
#>
#>
#>
#> $exchanges[[1]]$method
#> [1] "tools/list"
#>
#> $exchanges[[1]]$ok
#> [1] TRUE
#>
#> $exchanges[[1]]$error_name
#> NULL
#>
#>
#> $exchanges[[2]]
#> $exchanges[[2]]$request
#> $exchanges[[2]]$request$jsonrpc
#> [1] "2.0"
#>
#> $exchanges[[2]]$request$id
#> [1] 2
#>
#> $exchanges[[2]]$request$method
#> [1] "tools/call"
#>
#> $exchanges[[2]]$request$params
#> $exchanges[[2]]$request$params$name
#> [1] "add"
#>
#> $exchanges[[2]]$request$params$arguments
#> $exchanges[[2]]$request$params$arguments$a
#> [1] 2
#>
#> $exchanges[[2]]$request$params$arguments$b
#> [1] 3
#>
#>
#>
#>
#> $exchanges[[2]]$response
#> $exchanges[[2]]$response$jsonrpc
#> [1] "2.0"
#>
#> $exchanges[[2]]$response$id
#> [1] 2
#>
#> $exchanges[[2]]$response$result
#> $exchanges[[2]]$response$result$content
#> [1] 5
#>
#>
#>
#> $exchanges[[2]]$method
#> [1] "tools/call"
#>
#> $exchanges[[2]]$ok
#> [1] TRUE
#>
#> $exchanges[[2]]$error_name
#> NULL
#>
#>
#>
#> $n_ok
#> [1] 2
#>
#> $n_errors
#> [1] 0
#>
#> $methods
#> [1] "tools/list" "tools/call"
#>
#> $wire_bytes
#> [1] NA
#>
#> $estimate
#> [1] 2
#>
#> $n
#> [1] 2
#>
#> $method
#> [1] "MCP / JSON-RPC 2.0 exchange with envelope validation"
#>
morie_geron_multilabel(X = loud, Y = loud)
#> $Y_pred
#> [,1]
#> [1,] 1
#> [2,] 1
#> [3,] 1
#> [4,] 1
#> [5,] 1
#> [6,] 1
#> [7,] 1
#> [8,] 1
#> [9,] 1
#> [10,] 1
#> [11,] 1
#> [12,] 1
#> [13,] 1
#> [14,] 1
#> [15,] 1
#> [16,] 1
#> [17,] 1
#> [18,] 1
#> [19,] 1
#> [20,] 1
#> [21,] 1
#> [22,] 1
#> [23,] 1
#> [24,] 1
#> [25,] 1
#> [26,] 1
#> [27,] 1
#> [28,] 1
#> [29,] 1
#> [30,] 1
#> [31,] 1
#> [32,] 1
#> [33,] 1
#> [34,] 1
#> [35,] 1
#> [36,] 1
#> [37,] 1
#> [38,] 1
#> [39,] 1
#> [40,] 1
#> [41,] 1
#> [42,] 1
#> [43,] 1
#> [44,] 1
#> [45,] 1
#> [46,] 1
#> [47,] 1
#> [48,] 1
#> [49,] 1
#> [50,] 1
#> [51,] 1
#> [52,] 1
#> [53,] 1
#> [54,] 1
#> [55,] 1
#> [56,] 1
#> [57,] 1
#> [58,] 1
#> [59,] 1
#> [60,] 1
#> [61,] 1
#> [62,] 1
#> [63,] 1
#> [64,] 1
#>
#> $subset_accuracy
#> [1] 1
#>
#> $hamming_loss
#> [1] 0
#>
#> $jaccard
#> [1] 1
#>
#> $per_label_f1
#> [1] 1
#>
#> $macro_f1
#> [1] 1
#>
#> $zero_baseline_hamming
#> [1] 1
#>
#> $source
#> [1] "leave-one-out 3-NN binary relevance"
#>
#> $estimate
#> [1] 1
#>
#> $n
#> [1] 64
#>
#> $method
#> [1] "Multilabel classification (binary relevance kNN, leave-one-out)"
#>