predictModel: Predict model on server site

View source: R/predict_model.R

predictModelR Documentation

Predict model on server site

Description

This function enables to make predictions on the server for any model. Requirement is that it can be serialized and deserialized without loosing model components. Therefore, use 'check_serialization = TRUE'.

Usage

predictModel(
  connections,
  mod,
  pred_name,
  dat_name = "D",
  predict_fun = "predict(mod, newdata = D)",
  repush = FALSE,
  check_serialization = TRUE,
  package = NULL,
  just_return_call = FALSE
)

Arguments

connections

('DSI::connection') Connection to an OPAL server.

mod

('arbitrary') R object containing a model which is used for predictions on the server.

pred_name

('character(1L)') Name of the object predictions should be assigned to.

dat_name

('character(1L)') Name of the data object on the server (default is '"D"'.

predict_fun

('character(1L)') The prediction function call as string. As placeholder use 'mod' for the model and 'D' for the data, e.g. 'predict(mod, newdata = D)'. This gives the possibility to call arbitrary predict function like ‘predict(mod, newdata = D, type = \"response\", family = binomial())’ for a GLM. The default is 'predict(mod, newdata = D)'.

repush

('logical(1L)') Logical value indicating if the model should again pushed to the server (default is 'TRUE').

check_serialization

('logical(1L)') Check if the serialized model can be deserialized locally (default is 'TRUE').

package

('character(1L)') Package required for model predictions (default is 'NULL').

just_return_call

('logical(1L)') Just return the call and not execute on server (mainly for testing purposes, default is 'FALSE').

Value

The prediction object returned from 'DSI::datashield.assign'

Author(s)

Daniel S.


difuture-lmu/dsROCGLM documentation built on March 24, 2024, 1:07 p.m.