Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

toymodel1

A minimal, dependency-free toy prediction model for the ModelsCloud platform. It predicts a risk from three predictors using a fixed-coefficient logistic score — illustrative only, not a real risk model.

Predictors

  • sex — patient sex, coded 0 = female, 1 = male.
  • age — age in years.
  • marker_value — a generic numeric biomarker; higher values raise the predicted risk.

It implements the standard prediction-model API:

Function Role
model_run(model_input) Predict for a table of patients (synchronous)
get_sample_input() Return an example input dataset

model_run() also draws a barplot of the predicted risks as a side effect. On the server OpenCPU captures this plot automatically, so it can be retrieved with modelscloud::get_plots().

Via modelscloud

library(modelscloud)

# Public testing key — fine to use for trying out the examples collection
connect_to_model("examples/toymodel1",
                 access_key = "23b7bab3-118e-4516-b53c-91bca8e0082d")

sample <- get_sample_input()
result <- model_run(sample)

# Retrieve the barplot the model produced
get_plots(result)            # list available plots
img <- get_plots(result, id = 1)   # retrieve the barplot
plot(img)                          # display it

Prediction models are typically called synchronously in this way.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages