A Syberia engine to interact with Microsoft / Revolution Analytics tooling for deployable models
R
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
lib
models/dev
test/lib
.Rprofile
.gitignore
LICENSE
README.md
example.png
lockfile.yml

README.md

Using Microsoft / RevoscaleR for modeling

A Syberia engine written at an R in Finance 2017 conference 30-min break to operationalize Microsoft R tooling.

See the model file example that will illustrate RevoscaleR models.

# Open R from the root of this project and execute:
run('lending')
model$predict(iris, verbose = TRUE)

You should see a stubbed message.

Example run

Goal

The full goal specification outlines what we wish to accomplish: to turn all Microsoft R tools into a unified modeling framework.

For more info see how to operationalize R models using Azure. Other items to integrate are: R batching and converting custmod to mungebits.

Other code

In the near future we will integrate the capabilities illustrated in the below script into the MicrosoftR engine.

library(RevoScaleR)
conStr <- "Driver string"
ds <- RxSqlServerData(sqlQuery = "SELECT revol, ....")
df <- rxImport(ds)
rxSetComputeContext("local")
dxForestModel <- rxDForest(is_bad ~ revol_util + ..., df)

# Or train model remotely:
sqlCC <- RxInSqlServer(connectingString = conStr)
rxSetComputeContext(sqlCC)
dForestModel <- rxDForest(is_bad ~ ..., ds)

# Deploy model object and publish flexible and realtime services
library(mrsdeploy)
remoteLogin("http://foo:12800", username = "...", password = "...")
pause()

putLocalObject("dForestModel")

snapshot <- createSnapshot("dforest-model-snapshot")
rCode <- "require(RevoScaleR); prediction <- rxPredict(dForestModel, inputData)"
regularService <- "rService"
version <- "1.0"
regularServiceApi <- publishService(name = regularService,
 v = version, code = rCode, snapshot = snapshot,
 inputs = list(inputData = 'data.frame'),
 output = list(prediction = 'data.frame'),
 alias = 'rService')

td <- head(df, n = 1)
op1 < -regularServiceApi$rService(inputData = testData
op1$outputParameters$prediction$is_bad_red

rxPredict(dFOrestModel, td)

all.equal(op1$outputParameters$prediction_is_bad_pred,
          op2$outputParameters$outputData$is_bad_pred)

Overview

Note: This is copied from the modeling engine.

This repository gives a full example of how to use Syberia for a modeling project. It consists of the following files:

  • The lockfile - A specification of which packages should be loaded for an R session using this project through lockbox.
  • The engines file - This file is necessary for any Syberia project. In this example, we are using the modeling engine.
  • An example model - A trivial model showing how to create an lm classifier with some trivial feature engineering. After running this model, the final output will be in a global variable called model.
  • An example mungebit - A trivial mungebit, the Syberia approach to feature engineering that allows re-use of the same code during experimental sandbox training and real-time prediction.

To run the example model, type run("example1"). This uses fuzzy matching, so you can run the model by leaving out letters as long as they appear consecutively in the model filename: run("ex1") or run("mple") will work equally well.