vignettes/experiments-deep-dive/accident_predict_caret.R

#' Copyright(c) Microsoft Corporation.
#' Licensed under the MIT license.

library(jsonlite)

init <- function()
{
  model_path <- Sys.getenv("AZUREML_MODEL_DIR")
  model <- readRDS(file.path(model_path, "model.rds"))
  method <- model$method
  message(paste(method, "model loaded"))
  
  function(data)
  {
    vars <- as.data.frame(fromJSON(data))
    prediction <- predict(model, newdata=vars, type="prob")[,"dead"]
    toJSON(prediction)
  }
}

Try the azuremlsdk package in your browser

Any scripts or data that you put into this service are public.

azuremlsdk documentation built on Oct. 23, 2020, 8:22 p.m.