Web app as a plugin usign R Shiny
Can I turn an R shiny web app into a plugin, and use it inside the LAB as a model view?
or is it only possible with a standard HTML web app?
Operating system used: Windows
Best Answer
-
Sarina Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 317 Dataiker
Hi @MNOP
,
You can create a plugin with an R Shiny webapp to be displayed in the Visual ML analysis view.
From your Shiny weabpp, you will select "Convert to plugin webapp" from your R shiny webapp:In the newly created plugin webapp.json file, you will need to ensure that the roles are defined for ANALYSIS, like so:
"roles": [ { "type": "SAVED_MODEL", "contentType": "prediction", "backendTypes": ["PY_MEMORY"], "predictionTypes": ["BINARY_CLASSIFICATION"], "targetParamsKey": "modelId", "pathParamsKey": "versionId" }, { "type": "ANALYSIS", "contentType": "prediction", "backendTypes": ["PY_MEMORY"], "predictionTypes": ["BINARY_CLASSIFICATION"], "targetParamsKey": "trainedModelFullModelId" } ]
You will also need to create an R code environment for your plugin. You can do so by creating a new "R" code environment from the "Summary" tab of your plugin:
Then, you'll want to makes sure that any required R packages are listed in your plugin's rPackages.txt file, and you'll need to then build your code environment back on the "Summary" tab of the plugin, after you've fully set up the code environment specs like so:
Here is an example of the basic shiny webapp example converted to a plugin that is available in the Visual ML Analysis screen:
I'm attaching an example of this plugin in case it's helpful as a reference point.
Thanks!
Sarina
Answers
-
@SarinaS
Thank you for your response.
I am trying to create a model view that provides different error metrics for various slices and dice of test and train data. To achieve this, I need to access the model object, train and test data, etc. I was wondering if it is possible to do this using R.
Can I access the saved model and data inside an R script? -
Sarina Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 317 Dataiker
HI @MNOP
,
Ah indeed, the R API is quite limited compared to the Python API, and you would need to use the Python API for any Saved Model data. So it might be easier to use a Python-backed webapp instead of R Shiny in this case.
Thanks,
Sarina -
@SarinaS
One more question,
Is it possible to access the Shapley values using the python API?