The xai2cloud
package automates the process of deploying model explainers to the cloud. Create a web API from an DALEX explainer and deploy it with just one R function. Deployment can be done either locally or directly to the DigitalOcean’s cloud, which can be achievied after a quick setup. The whole step by step guide can be found below.
# Install the development version from GitHub:
devtools::install_github("ModelOriented/xai2cloud")
The main function is called deploy_explainer which creates a REST API and a swagger for it based on the explainer. If you have an DigitalOcean account and a droplet with installed R 3.5+ it can also deploy the model directly to the cloud. At the time it supports five post/get functionalities:
If you already have a DigitalOcean’s droplet with an appropriate R version (3.5+) or just want to plumb the explainer locally, skip the first section below.
devtools::install_github("trestletech/plumber")
install.packages("analogsea")
install.packages("ssh")
analogsea::droplets()
to check the connection to your DigitalOcean’s account.xai2cloud::do_setup(model_package = "name of package used to create the model - eg. randomForest, gbm, stats")
. This will start a virtual machine (a new droplet) and install R with develompent version of plumber and all needed packages: DALEX, iBreakDown, ingredients, ggplot2 and the package specified in model_package parameter.Now you are ready to use the function deploy_explainer. It requires only two parameters to deploy locally:
In order to deploy the explainer directly to the cloud, set up:
analogsea::droplets
). If you wish to plumb it locally, set it to NA
.Additional parameters:
After using the deploy_explainer function with appropriate droplet’s ID, you can access the web API at: your_droplet_ip/your_explainers_name/swagger/
If you didn’t put your droplet’s number, you have started the plumber’s swagger locally. You can access it at: http://127.0.0.1:port/__swagger__/