mirror of
https://github.com/Azure/MachineLearningNotebooks.git
synced 2025-12-19 17:17:04 -05:00
17 lines
453 B
R
17 lines
453 B
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"))
|
|
message("logistic regression model loaded")
|
|
|
|
function(data) {
|
|
vars <- as.data.frame(fromJSON(data))
|
|
prediction <- as.numeric(predict(model, vars, type = "response") * 100)
|
|
toJSON(prediction)
|
|
}
|
|
}
|