Watson Machine Learning Python client samples and examples
Review and use sample Jupyter notebooks that use the Watson Machine Learning Python library to demonstrate machine learning features and techniques. Each notebook lists learning goals so you can find the one that best meets your goals.
The samples are built by using the V4 version of the Watson Machine Learning Python client library.
Watch this video to learn how to train, deploy, and test a machine learning model in a Jupyter notebook. This video mirrors the Use scikit-learn to recognize hand-written digits found in the Deployment samples table.
This video provides a visual method to learn the concepts and tasks in this documentation.
Helpful variables
The pre-defined PROJECT_ID
environment variable makes it easier to call the Watson Machine Learning Python client APIs. PROJECT_ID
is the guid of the project where your environment is running.
Deployment samples
View or run these Jupyter notebooks to see how techniques are implemented using various frameworks. Some of the samples rely on trained models, which are also available for you to download from the public repository.
Sample name | Framework | Techniques demonstrated |
---|---|---|
Use scikit-learn and custom library to predict temperature | Scikit-learn | Train a model with custom defined transformer Persist the custom defined transformer and the model in Watson Machine Learning repository Deploy the model using Watson Machine Learning Service Perform predictions using the deployed model |
Use PMML to predict iris species | PMML | Deploy and score a PMML model |
Use Python function to recognize hand-written digits | Python | Use a function to store a sample model then deploy it |
Use scikit-learn to recognize hand-written digits | Scikit-learn | Train sklearn model Persist trained model in Watson Machine Learning repository Deploy model for online scoring using client library Score sample records using client library |
Use Spark and batch deployment to predict customer churn | Spark | Load a CSV file into an Apache Spark DataFrame Explore data Prepare data for training and evaluation Create an Apache Spark machine learning pipeline Train and evaluate a model Persist a pipeline and model in Watson Machine Learning repository Explore and visualize prediction result using the plotly package Deploy a model for batch scoring using Watson Machine Learning API |
Use Spark and Python to predict Credit Risk | Spark | Load a CSV file into an Apache® Spark DataFrame Explore data Prepare data for training and evaluation Persist a pipeline and model in Watson Machine Learning repository from tar.gz files Deploy a model for online scoring using Watson Machine Learning API Score sample scoring data using the Watson Machine Learning API Explore and visualize prediction result using the plotly package |
Use SPSS to predict customer churn | SPSS | Work with the instance Perform an online deployment of the SPSS model Score data using deployed model |
Use XGBoost to classify tumors | XGBoost | Load a CSV file into numpy array Explore data Prepare data for training and evaluation Create an XGBoost machine learning model Train and evaluate a model Use cross-validation to optimize model's hyperparameters Persist a model in Watson Machine Learning repository Deploy a model for online scoring Score sample data |
Use Keras to recognize hand-written digits.ipynb | Keras (Tensorflow) | Download an externally trained Keras model with dataset. Persist an external model in Watson Machine Learning repository. Deploy model for online scoring using client library. Score sample records using client library. |
Deploy Python function for software specification | Core | Create a Python function Create a web service Score the model |
Machine Learning artifact management | Core | Export and import artifacts Load, deploy and score externally created models |
Use R Shiny app to create SIR model | R | Persist an R Shiny app in in Watson Machine Learning asset repository. Deploy application for online scoring using client library. Score sample records using client library. |
AutoAI samples
View or run these Jupyter notebooks to see how AutoAI model techniques are implemented.
Sample name | Framework | Techniques demonstrated |
---|---|---|
Use AutoAI and Lale to predict credit risk | Hybrid (AutoAI) with Lale | Work with Watson Machine Learning experiments to train AutoAI models Compare trained models quality and select the best one for further refinement Refine the best model and test new variations Deploy and score the trained model |
Parent topic: Training and deploying machine learning models in notebooks