alex23lemm / zementisr

R client for the Zementis Server API

Home Page:https://alex23lemm.github.io/zementisr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zementisr

Travis-CI Build Status Coverage status

zementisr is an R client for the Zementis Server API. Zementis Server is an execution engine for PMML models which also comes with model management capabilities. Using zementisr, data scientists can deploy PMML models to Zementis Server, predict new values by sending data to the server and manage the entire PMML model life cycle without leaving their preferred R development environment.

Installation

# install.packages("devtools")
devtools::install_github("alex23lemm/zementisr")

Usage

zementisr deploys PMML models to Zementis Server and manages the model lifecycle. Below are some of the things you can do once you have converted your R prediction model to PMML.

Check out the quickstart guide and the docs for further details.

library(pmml)

# Build a simple lm model and convert it to PMML
iris_lm <- lm(Sepal.Length ~ ., data=iris)
iris_pmml <- pmml(iris_lm, model_name = "iris_model")


library(zementisr)

# Deploy PMML model to Zementis Server
upload_model(iris_pmml)
#> $model_name
#> [1] "iris_model"
#> 
#> $is_active
#> [1] TRUE

# Get prediction for new value from Zementis Server
predict_pmml(iris[42, ], "iris_model")
#> $model
#> [1] "iris_model"
#> 
#> $outputs
#>   Predicted_Sepal.Length
#> 1               4.295281

# Deactivate PMML model on Zementis Server
deactivate_model("iris_model")
#> $model_name
#> [1] "iris_model"
#> 
#> $is_active
#> [1] FALSE

# Activate PMML model on Zementis Server
activate_model("iris_model")
#> $model_name
#> [1] "iris_model"
#> 
#> $is_active
#> [1] TRUE

# Delete PMML model from Zementis Server
delete_model("iris_model")
#> character(0)

Authentication

Zementis Server’s REST API uses HTTP Basic Authentication. For each request the client needs to provide username and password.

The zementisr package requires that you store your secrets and the base URL of your Zementis Server as environment variables in the .Renviron file in your home directory.

Please, make sure to set the environment variables below in your .Renviron file before using functions from the zementisr package. You can easily edit .Renviron using usethis::edit_r_environ().

ZEMENTIS_base_url = [address]
ZEMENTIS_usr = [your_username]
ZEMENTIS_pwd = [your_password]

About

R client for the Zementis Server API

https://alex23lemm.github.io/zementisr/

License:Other


Languages

Language:R 100.0%