codegen.RdEXPERIMENTAL STATE - MAY NOT WORK AS INTENDED
Score code will only be generated successfully for supported models.
Other models and frameworks will be added in due time.
Use create_scoreSample() to get a structure sample
Disclaimer: The score code that is generated is designed to be a working template for an R model, but is not guaranteed to work out of the box for scoring, publishing, or validating the model.
codegen(model, path, rds, libs, inputs, ...)
# S3 method for class 'lm'
codegen(
  model,
  path = "scoreCode.R",
  rds = "model.rds",
  libs = c(),
  inputs = NULL,
  ...
)
# S3 method for class 'glm'
codegen(
  model,
  path = "scoreCode.R",
  rds = "model.rds",
  libs = c(),
  inputs = NULL,
  cutoff = 0.5,
  ...
)
# S3 method for class 'workflow'
codegen(
  model,
  path = "scoreCode.R",
  rds = "model.rds",
  libs = c(),
  inputs = NULL,
  referenceLevel = NULL,
  ...
)model object (lm, glm, tidymodels workflow, ...)
file name and path to write
.rds file name to be called
vector of libraries to be added to the code. Some may be guessed from the type.
define inputs as the passed vector instead of guessed
to be passes to individual code generators
classification probability cutoff
reference level for a factor target value
a code string
codegen(lm): Code generator for lm class models
codegen(glm): generator for glm class models, specifically logistic regression
codegen(workflow): generator for tidymodels workflow class models