{"id":13857521,"url":"https://github.com/ModelOriented/xai2cloud","last_synced_at":"2025-07-13T21:33:07.718Z","repository":{"id":98024951,"uuid":"254081073","full_name":"ModelOriented/xai2cloud","owner":"ModelOriented","description":"Create web API from model explainers","archived":false,"fork":false,"pushed_at":"2020-06-17T12:49:13.000Z","size":9258,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-06T03:04:03.956Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ModelOriented.github.io/xai2cloud/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ModelOriented.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-04-08T12:26:32.000Z","updated_at":"2024-03-12T12:46:00.000Z","dependencies_parsed_at":"2024-02-09T01:56:14.888Z","dependency_job_id":"8385980b-d147-4606-b536-44677f1de0d3","html_url":"https://github.com/ModelOriented/xai2cloud","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelOriented%2Fxai2cloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelOriented%2Fxai2cloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelOriented%2Fxai2cloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModelOriented%2Fxai2cloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ModelOriented","download_url":"https://codeload.github.com/ModelOriented/xai2cloud/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225920380,"owners_count":17545479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-05T03:01:39.594Z","updated_at":"2024-11-22T15:30:54.492Z","avatar_url":"https://github.com/ModelOriented.png","language":"R","readme":"# xai2cloud\n\n\u003c!-- badges: start --\u003e\n[![R build status](https://github.com/ModelOriented/xai2cloud/workflows/R-CMD-check/badge.svg)](https://github.com/ModelOriented/xai2cloud/actions?query=workflow%3AR-CMD-check)\n[![Codecov test coverage](https://codecov.io/gh/ModelOriented/xai2cloud/branch/master/graph/badge.svg)](https://codecov.io/gh/ModelOriented/xai2cloud?branch=master)\n\u003c!-- badges: end --\u003e\n\n## Overview\n\nThe `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.\n\n## Examples\n\n- [x] [Titanic (Random Forest) explainer](http://167.172.203.24/titanic_explainer/__swagger__/)\n- [x] [Apartments (Linear Model) explainer](http://167.172.203.24/apartments_explainer/__swagger__/)\n\n## Installation\n\n```\n# Install the development version from GitHub:\ndevtools::install_github(\"ModelOriented/xai2cloud\")\n```\n\n## Functionality\n\n\u003ccenter\u003e\u003cimg width=600 src=\"figures/xai2cloud_diagram.png\"\u003e\u003c/center\u003e\n\nThe 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:\n\n- Predict a result\n- Break Down plot\n- SHAP values plot\n- Ceteris Paribus plot\n- Break Down description\n- Ceteris Paribus description\n\n## How to use?\n\nIf 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.\n\n### How to create a new *DigitalOcean* droplet?\n\n1. If you don't have an account on *DigitalOcean*, create one [here.](https://m.do.co/c/c07558eaca11)\n2. Install development version of **plumber** R package by using ```devtools::install_github(\"trestletech/plumber\")```\n3. Install **analogsea** R package by using ```install.packages(\"analogsea\")```\n4. Install **ssh** R package by using ```install.packages(\"ssh\")```\n5. [Create an SSH key](https://help.github.com/en/enterprise/2.17/user/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent?fbclid=IwAR3E66nCkq5cS6BSSHvgv-tzFa9MjWL37bUgRz3DKwglTO8Zn_t6tmKwvRo)\n6. [Deploy the SSH key to DigitalOcean](https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/to-account/)\n6. Run ```analogsea::droplets()``` to check the connection to your *DigitalOcean's* account.\n7. Run ```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.\n8. Access port 8000 on your droplet's IP. If you see a response from *plumber*, everything works so far.\n\n\n### How to plumb the explainer?\n\nNow you are ready to use the function **deploy_explainer**. It requires only two parameters to deploy locally:\n- **exp_name** - name of an *.rda* file containing an explainer in your working directory or an explainer object.\n- **model_package** - name of the package used to create the explained model. The name must be accurate, letter case is important.\n\nIn order to deploy the explainer directly to the cloud, set up:\n- **droplet** - numeric - your *DigitalOcean's* droplet number (check it by typing ```analogsea::droplets```). If you wish to plumb it locally, set it to ```NA```.\n- **port** - numeric - port that you would like to deploy your explainer to.\n\nAdditional parameters:\n- **deploy** - boolean telling whether the plumber file is run on set port. If set to false, plumber file will be created but not run.\n- **title** - title to be seen in Swagger.\n\n#### *DigitalOcean*\nAfter using the **deploy_explainer** function with appropriate droplet's ID, you can access the web API at:\nyour_droplet_ip/your_explainers_name/__swagger__/\n\n#### *Local*\nIf you didn't put your droplet's number, you have started the plumber's swagger locally. You can access it at:\nhttp://127.0.0.1:port/__swagger__/\n\n","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FModelOriented%2Fxai2cloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FModelOriented%2Fxai2cloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FModelOriented%2Fxai2cloud/lists"}