Lab build

Iris classifier with CircleCI, GitLab CI and GitHub Actions

The same decision-tree classifier shipped to GKE through three separate CI/CD pipelines.

Role
Builder, end to end
Group
MLOps
Services
MLOps & cloud

What it does

The Iris dataset is cleaned with IQR-based outlier capping, split and used to train a Gini decision tree, with a Flask form serving predictions. The same app is delivered three ways: a CircleCI workflow, a GitLab CI pipeline and a GitHub Actions workflow, each building the Docker image, pushing it to Google Artifact Registry and deploying it to a GKE cluster.

What was built

  1. 01

    Processing caps outliers in a feature column at 1.5 times the IQR, splits the data and saves it with joblib.

  2. 02

    DecisionTreeClassifier (gini, max depth 30) is trained, evaluated and saved for the Flask app.

  3. 03

    CircleCI workflow runs checkout, build-and-push and deploy jobs in a google/cloud-sdk executor.

  4. 04

    GitLab pipeline builds in Docker-in-Docker and applies the Kubernetes manifest to GKE.

  5. 05

    GitHub Actions tags images with the commit SHA and runs kubectl set image on the deployment.

The pipeline, layer by layer

Five layers, one pipeline.

  1. L1Training

    • Iris CSV
    • Outlier capping
    • Decision tree model
  2. L2Serving

    • Flask form
  3. L3CI/CD options

    • CircleCI
    • GitLab CI
    • GitHub Actions
  4. L4Registry

    • Artifact Registry
  5. L5Runtime

    • GKE deployment

Stack

  • scikit-learn
  • pandas
  • joblib
  • Flask
  • Docker
  • CircleCI
  • GitLab CI/CD
  • GitHub Actions
  • Google Artifact Registry
  • GKE

Next lab build · 23 / 46

Mobile price classifier on SageMaker

Trains a Random Forest mobile price classifier on SageMaker spot instances and serves it from an endpoint.

Previous: Australia rain prediction with three CI/CD systems

Need a system like this in production? Tell us about it.