Join the Digital Developer Conference: AIOps & Integration to propel your AI-powered automation skills Register for free

Generate a Python notebook for pipeline models using AutoAI


In this code pattern, learn how to use AutoAI to automatically generate a Jupyter Notebook that contains Python code of a machine learning model. Then, explore, modify, and retrain the model pipeline using Python before deploying the model in IBM Watson® Machine Learning using Watson Machine Learning APIs.


AutoAI is a graphical tool available within IBM Watson Studio that analyzes your data set, generates several model pipelines, and ranks them based on the metric chosen for the problem. This code pattern shows extended features of AutoAI. More basic AutoAI exploration for the same data set is covered in the Generate machine learning model pipelines to choose the best model for your problem tutorial.

When you have completed this code pattern, you understand how to:

  • Run an AutoAI experiment
  • Generate and save a Python notebook
  • Execute the notebook and analyze results
  • Make changes and retrain the model using Watson Machine Learning SDKs
  • Deploy the model using Watson Machine Learning from within the notebook



  1. The user submits an AutoAI experiment using default settings.
  2. Multiple pipeline models are generated. A pipeline model of choice from the leaderboard is saved as a Jupyter Notebook.
  3. The Jupyter Notebook is executed, and a modified pipeline model is generated within the notebook.
  4. The pipeline model is deployed in Watson Machine Learning using Watson Machine Learning APIs.


Get detailed instructions in the readme file. These instructions explain how to:

  1. Run an AutoAI experiment.
  2. Save the AutoAI-generated notebook.
  3. Load and execute the notebook.
  4. Deploy and score as a web service using a Watson Machine Learning instance.