0 / 0
Watson Machine Learning Python client samples and examples

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 as an alternative to following the written steps in this documentation.

Watch this video to learn how to test a model that was created with AutoAI by using the Watson Machine Learning APIs in Jupyter notebook.

This video provides a visual method as an alternative to following the written steps 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
Persist and deploy a Decision Optimization model Decision Optimization Load a DO model file into an Watson Machine Learning repository
Prepare data for training and evaluation
Create an DO machine learning job
Persist a DO model Watson Machine Learning repository
Deploy a model for batch scoring using Watson Machine Learning API
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 Spark to predict product line 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
Predict business for cars Spark Set up an AI definition
Prepare the data
Create a model
Deploy and score the model
Define, store and deploy a Python function
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 Decision Optimization to plan your diet Core Create a diet planning model by using Decision Optimization
Use SPSS and batch deployment with DB2 to predict customer churn SPSS 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 scikit-learn and AI lifecycle capabilities to predict Boston house prices Scikit-learn Load a sample data set from scikit-learn
Explore data
Prepare data for training and evaluation
Create a scikit-learn pipeline
Train and evaluate a model
Store a model in the Watson Machine Learning repository
Deploy a model with AutoAI lifecycle capabilities
German credit risk prediction with Scikit-learn for model monitoring Scikit-learn Train, create, and deploy a credit risk prediction model with monitoring
Monitor German credit risk model Scikit-learn Train, create, and deploy a credit risk prediction model with IBM Watson OpenScale capabilities

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
Use AutoAI to predict credit risk Hybrid (AutoAI) 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

Additional resources

From the Gallery, you can review or run a series of end-to-end industry accelerators that demonstrate a range of services and solutions. For details on accessing and running these samples, refer to Industry accelerators.

Parent topic: Training and deploying machine learning models in notebooks