Saving an AutoAI generated notebook
To view the code that created a particular experiment, or interact with the experiment programmatically, you can save an experiment as a notebook. You can also save an individual pipeline as a notebook so that you can review the code that is used in that pipeline.
Working with AutoAI-generated notebooks
When you save an experiment or a pipeline as notebook, you can:
- Access the saved notebooks from the Notebooks section on the Assets tab.
- Review the code to understand the transformations applied to build the model. This increases confidence in the process and contributes to explainable AI practices.
- Add task credentials. See Adding task credentials
- Enter API key. See Managing the user API key
- Use and run the code within watsonx.ai Studio, or download the notebook code to use in another notebook server. No matter where you use the notebook, it automatically installs all required dependencies, including libraries for:
xgboost
lightgbm
scikit-learn
autoai-libs
ibm-watson-machine-learning
snapml
- View the training data used to train the experiment and the test (holdout) data used to validate the experiment.
Notes:
- Auto-generated notebook code excutes successfully as written. Modifying the code or changing the input data can adversely affect the code. If you want to make a significant change, consider retraining the experiment by using AutoAI.
- For more information on the estimators, or algorithms, and transformers that are applied to your data to train an experiment and create pipelines, refer to Implementation details.
Saving an experiment as a notebook
Save all of the code for an experiment to view the transformations and optimizations applied to create the model pipelines.
What is included with the experiment notebook
The experiment notebook provides annotated code so you can:
- Interact with trained model pipelines
- Access model details programmatically (including feature importance and machine learning metrics).
- Visualize each pipeline as a graph, with each node documented, to provide transparency
- Compare pipelines
- Download selected pipelines and test locally
- Create a deployment and score the model
- Get the experiment definition or configuration in watsonx.ai Python SDK, which you can use for automation or integration with other applications.
Saving the code for an experiment
To save an entire experiment as a notebook:
- After the experiment completes, click Save code from the Progress map panel.
- Name your notebook, add an optional description, choose a runtime environment, and save.
- Click the link in the notification to open the notebook and review the code. You can also open the notebook from the Notebooks section of the Assets tab of your project.
Saving an individual pipeline as a notebook
Save an individual pipeline as a notebook so you can review the Scikit-Learn source code for the trained model in a notebook.
The pipeline notebook provides annotated code that you can use to complete these tasks:
- View the Scikit-learn pipeline definition
- See the transformations applied for pipeline training
- Review the pipeline evaluation
Saving a pipeline as a notebook
To save a pipeline as a notebook:
- Complete your AutoAI experiment.
- Select the pipeline that you want to save in the leaderboard, and click Save from the action menu for the pipeline, then Save as notebook.
- Name your notebook, add an optional description, choose a runtime environment, and save.
- Click the link in the notification to open the notebook and review the code. You can also open the notebook from the Notebooks section of the Assets tab.
Create sample notebooks
To see for yourself what AutoAI-generated notebooks look like:
- Follow the steps in the AutoAI tutorial to create a binary classification experiment from sample data.
- After the experiment runs, click Save code in the experiment details panel.
- Name and save the experiment notebook.
- To save a pipeline as a model, select a pipeline from the leaderboard, then click Save and Save as notebook.
- Name and save the pipeline notebook.
- From Assets tab, open the resulting notebooks in the notebook editor and review the code.
Additional resources
- For details on the methods used in the code, see watsonx.ai Python SDK.
Parent topic: AutoAI overview