Class-based API
Build production ML pipelines from the simple step interface.
The class-based ZenML API is defined by the base classes BaseStep and BasePipeline. These interfaces allow our users to maintain a higher level of control while they are creating a step definition and using it within the context of a pipeline.
A user may also mix-and-match the Functional API with the Class Based API: All standard data types and steps that are applicable in both of these approaches.
In order to illustrate how the class-based API functions, we'll do a simple exercise to build our standard built-in training pipeline piece-by-piece.
If you just want to see all the code for each chapter of the guide, head over to the GitHub version
If not, then get your environment ready and follow along!

Set up locally

In order to run the chapters of the guide, you need to install and initialize ZenML:
1
pip install zenml
2
zenml integration install tensorflow
3
zenml integration install sklearn
4
5
# pull example
6
zenml example pull class_based_api
7
cd zenml_examples/class_based_api
8
9
# initialize
10
zenml init
Copied!
In general, to run each chapter you can do:
1
python chapter_*.py # for the chapter of your choice
Copied!
Note before executing each chapter, make sure to clean the old chapter artifact and metadata store:
1
rm -rf .zen
2
zenml init # start again
Copied!

Clean up

In order to clean up, delete the remaining zenml references.
1
rm -rf zenml_examples
Copied!
Press next to start the first chapter!
Last modified 22h ago
Export as PDF
Copy link
Edit on GitHub