Skip to content

Instantly share code, notes, and snippets.

@dec100
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dec100/44351d5cd16efa862a55 to your computer and use it in GitHub Desktop.
Save dec100/44351d5cd16efa862a55 to your computer and use it in GitHub Desktop.
score.R
library(RevoScriptTools)
revoPackage('party')
# load the model
if (!exists('iris.cf')) load('model.RData')
# provide some values for an observation to be scored:
revoInput('{"name": "Sepal.Length","render": "numeric","default": 150.1}')
revoInput('{"name": "Sepal.Width","render": "numeric","default": 5.9}')
revoInput('{"name": "Petal.Length","render": "numeric","default": 3.1}')
revoInput('{"name": "Petal.Width","render": "numeric","default": 1.8}')
# create a data.frame
obs<-data.frame(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)
# score the observation and report the predicted value
Prediction <- predict(iris.cf, obs, OOB=TRUE, type = "response")
Prediction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment