score a data.frame MASmodule/model
masScore(
session,
module,
data,
exact = TRUE,
ScoreType = "score",
forceTrail = TRUE,
...
)viya_connection object, obtained through session function
MASmodule object, module name. If name, will try to find a single module with exact name match. See exact parameter
data.frame data.frame of the data
the filter query should use "contains" for partial match or "eq" for exact match
execute for decision, score for model
boolean, if the mas model is a decision (execute), it will force add a trailing underscore (_) in variable names.
additional parameters to be passed to httr::GET such as httr::add_headers
data.frame with scored rows
When the furrr package is installed, masScore uses furrr::future_map_dfr()
for scoring, which allows parallel execution via a future plan. Without furrr,
scoring runs sequentially using base R. Install both furrr and future to
enable parallel scoring.
if (FALSE) { # \dontrun{
# single row (sequential)
scored <- masScore(sess, "module_name", data[1,])
scored
# Parallel scoring — requires the furrr and future packages
# Not recommended for single rows due to parallelisation overhead
future::plan(future::multisession, workers = future::availableCores() - 1)
scored <- masScore(sess, "module_name", data)
# Return to sequential execution
future::plan(future::sequential)
} # }