Example - Model training and deployment (Iris)
This topic uses Cloudera AI's built-in Python template project to walk you through an end-to-end example where we use experiments to develop and train a model, and then deploy it using Cloudera AI.
This example uses the canonical Iris dataset from Fisher and Anderson to build a model that predicts the width of a flower’s petal based on the petal's length.
The scripts for this example are available in the Python template project that ships with Cloudera AI. First, create a new project from the Python template:
-
cdsw-build.sh
- A custom build script used for models and experiments. Pip installs our dependencies, primarily thescikit-learn
library. -
fit.py
- A model training example to be run as an experiment. Generates themodel.pkl
file that contains the fitted parameters of our model. -
predict.py
- A sample function to be deployed as a model. Usesmodel.pkl
produced byfit.py
to make predictions about petal width.