-
-
Save sdgilley/7a08181976b0f4ed5cbe to your computer and use it in GitHub Desktop.
score.R - script used in Building and Using Models in DeployR Tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(deployrUtils) | |
deployrPackage("rpart") | |
# load the model | |
if (!exists("model")) load(file="model.rData") | |
# provide some values for an observation to be scored | |
deployrInput('{"name": "balance","render": "numeric","default": 2000}') | |
deployrInput('{"name": "numTrans","render": "numeric","default": 10}') | |
deployrInput('{"name": "creditLine","render": "numeric","default": 18}') | |
# create a data.frame | |
obs <- data.frame(balance, numTrans, creditLine) | |
# score the observation and report the predicted value | |
Prediction <- predict(model, obs) | |
Prediction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment