Path: blob/master/cpd4.7/notebooks/python_sdk/deployments/r_shiny/Use R Shiny app to create SIR model.ipynb
6408 views
Use R Shiny app to create SIR model with ibm-watson-machine-learning
This notebook contains steps and code to demonstrate support of external R Shiny application code with ibm-watson-machine-learning library available in PyPI repository.
Some familiarity with Python is helpful. This notebook uses Python 3.
Learning goals
The learning goals of this notebook are:
Persist a R Shiny app in in Watson Machine Learning asset repository.
Deploy application for online scoring using client library.
Score sample records using client library.
Contents
This notebook contains the following parts:
Connection to WML
Authenticate the Watson Machine Learning service on IBM Cloud Pack for Data. You need to provide platform url
, your username
and api_key
.
Alternatively you can use username
and password
to authenticate WML services.
Install and import the ibm-watson-machine-learning
package
Note: ibm-watson-machine-learning
documentation can be found here.
Working with spaces
First of all, you need to create a space that will be used for your work. If you do not have space already created, you can use {PLATFORM_URL}/ml-runtime/spaces?context=icp4data
to create one.
Click New Deployment Space
Create an empty space
Go to space
Settings
tabCopy
space_id
and paste it below
Tip: You can also use SDK to prepare the space for your work. More information can be found here.
Action: Assign space ID below
You can use list
method to print all existing spaces.
To be able to interact with all resources available in Watson Machine Learning, you need to set space which you will be using.
Download R Shiny app from git project using wget
Hint: To install wget
execute !pip install wget
.
Upload application as data asset
Note: You can see that application is saved in Watson Machine Learning Service.
Get deployments details
If you want to clean up all created assets:
experiments
trainings
pipelines
model definitions
models
functions
deployments
please follow up this sample notebook.
You successfully completed this notebook! You learned how to use Watson Machine Learning for SPSS model deployment and scoring.
Check out our Online Documentation for more samples, tutorials, documentation, how-tos, and blog posts.
Author
Amadeusz Masny, Python Software Developer in Watson Machine Learning at IBM Jan Sołtysik, Intern in Watson Machine Learning at IBM
Copyright © 2020-2025 IBM. This notebook and its source code are released under the terms of the MIT License.