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(pdftools) | |
# read the data from the pdf | |
url="http://www.idfpr.com/Forms/MC/ListofLicensedDispensaries.pdf" | |
text<-pdf_text(url) | |
t<-text | |
# strip out info about start date, end date, etc... it is not consistently formatted | |
# 13 8/24/2015 8/24/2016 280.000\r\n |
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
sampleData<-read.csv("http://packages.revolutionanalytics.com/datasets/ccFraud.csv", | |
nrows=100000) | |
# a simple tree model | |
library(rpart) | |
model <- rpart(fraudRisk~balance+numTrans+creditLine, data=sampleData) | |
save(model, file="model.rData") |
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
# Set MKL threads if Revolution R Open or Revoltion R Enterprise is available | |
if(require(Revobase)){ | |
setMKLthreads(4) | |
} | |
# Initialization | |
set.seed (1) |
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}') |