Learn R Programming

yhatr (version 0.15.1)

yhat.deploy: Deploy a model to Yhat's servers

Description

This function takes model.transform and model.predict and creates a model on Yhat's servers which can be called from any programming language via Yhat's REST API (see yhat.predict).

Usage

yhat.deploy(model_name, packages = c(), confirm = TRUE,
  custom_image = NULL)

Arguments

model_name
name of your model
packages
list of packages to install using apt-get
confirm
boolean indicating whether to prompt before deploying
custom_image
name of the image you'd like your model to use

Examples

Run this code
yhat.config <- c(
 username = "your username",
 apikey = "your apikey",
 env = "http://sandbox.yhathq.com/"
)
iris$Sepal.Width_sq <- iris$Sepal.Width^2
fit <- glm(I(Species)=="virginica" ~ ., data=iris)

model.require <- function() {
 # require("randomForest")
}

model.transform <- function(df) {
 df$Sepal.Width_sq <- df$Sepal.Width^2
 df
}
model.predict <- function(df) {
 data.frame("prediction"=predict(fit, df, type="response"))
}
## Not run: ------------------------------------
# yhat.deploy("irisModel")
# yhat.deploy("irisModelCustomImage", custom_image="myImage:latest")
## ---------------------------------------------

Run the code above in your browser using DataLab