score a data.frame MASmodule/model

masScore(
  session,
  module,
  data,
  exact = TRUE,
  ScoreType = "score",
  forceTrail = TRUE,
  ...
)

Arguments

session

viya_connection object, obtained through session function

module

MASmodule object, module name. If name, will try to find a single module with exact name match. See exact parameter

data

data.frame data.frame of the data

exact

the filter query should use "contains" for partial match or "eq" for exact match

ScoreType

execute for decision, score for model

forceTrail

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

Value

data.frame with scored rows

Details

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.

Examples


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)
} # }