
Task pipeline: preprocess -> model -> postprocess (Geron Ch 14, morie.fn hmhfpi)
Source:R/geron_w4b_native.R
morie_geron_hf_pipelines.RdTask pipeline: preprocess -> model -> postprocess (Geron Ch 14, morie.fn hmhfpi)
Examples
logits <- function(xs) matrix(c(2, 0, 0, 3), nrow = 2, byrow = TRUE)
morie_geron_hf_pipelines("sentiment-analysis", list("good", "bad"),
logits, labels = c("POSITIVE", "NEGATIVE"))
#> $predictions
#> $predictions[[1]]
#> $predictions[[1]]$label
#> [1] "POSITIVE"
#>
#> $predictions[[1]]$score
#> [1] 0.8807971
#>
#>
#> $predictions[[2]]
#> $predictions[[2]]$label
#> [1] "NEGATIVE"
#>
#> $predictions[[2]]$score
#> [1] 0.9525741
#>
#>
#>
#> $scores
#> [,1] [,2]
#> [1,] 0.88079708 0.1192029
#> [2,] 0.04742587 0.9525741
#>
#> $raw
#> [,1] [,2]
#> [1,] 2 0
#> [2,] 0 3
#>
#> $task
#> [1] "sentiment-analysis"
#>
#> $estimate
#> [1] 0.9166856
#>
#> $n
#> [1] 2
#>
#> $method
#> [1] "Task pipeline (preprocess -> model -> postprocess)"
#>