Browse by type
Penguin classification pipeline introduces modern ML pipeline development using Kubeflow Pipelines (KFP SDK v2) on Google Cloud Vertex Pipelines.
For in-depth design patterns, containerization principles, and technical rationales, see the Architecture & Design Spec.

This repository provides two pipeline definitions (pipeline_container.py and pipeline_component.py). Both pipelines execute the exact same machine learning workflow (Palmer Penguins data retrieval, feature suffix transformation, Random Forest model training, and evaluation):
pipeline_container.py -> kfp_container_pipeline.yaml):@dsl.container_component.Offers high affinity with standard container execution patterns and decoupled container toolchains.
Native KFP Component Pipeline (pipeline_component.py -> kfp_component_pipeline.yaml):
@dsl.component operations (*_op) exported from component packages (components.<name>).Dataset, Model, Metrics, ClassificationMetrics).Install project dependencies and set up the local virtual environment with uv:
uv sync
Run the full automated test suite (component domain logic, CLI adapters, KFP component adapters, and pipeline compilation):
uv run pytest
Compile either or both pipelines into standard KFP v2 Intermediate Representation (IR YAML):
Compile the CLI-based container pipeline into kfp_container_pipeline.yaml:
uv run python pipeline_container.py
Compile the native KFP component pipeline into kfp_component_pipeline.yaml:
uv run python pipeline_component.py
Follow the step-by-step instructions in the Deployment Guide to build linux/amd64 container images via Docker Buildx / Cloud Build and submit jobs to Vertex AI Pipelines.
dataset_url : strsuffix : str_xf).n_estimators : int100).random_state : int42).The pipeline consists of 4 container components located under components/:
components/data_generator)Fetches the Palmer Penguins dataset and splits it into training and evaluation partitions.
- Inputs: dataset_url (str), test_size (float), random_state (int)
- Outputs:
- train_data: dsl.Output[dsl.Dataset] (Raw train CSV)
- eval_data: dsl.Output[dsl.Dataset] (Raw eval CSV)
components/transform)Preprocesses train/eval data by adding the specified suffix to column names.
- Inputs:
- train_data: dsl.Input[dsl.Dataset]
- eval_data: dsl.Input[dsl.Dataset]
- suffix: str
- Outputs:
- transformed_train_data: dsl.Output[dsl.Dataset]
- transformed_eval_data: dsl.Output[dsl.Dataset]
components/trainer)Trains a Random Forest classifier using scikit-learn on the transformed training dataset.
- Inputs:
- transformed_train_data: dsl.Input[dsl.Dataset]
- suffix: str
- n_estimators: int
- random_state: int
- Outputs:
- trained_model: dsl.Output[dsl.Model] (Model pickle artifact)
components/evaluator)Evaluates the trained model against the transformed evaluation dataset, logging quantitative accuracy and confusion matrix.
- Inputs:
- trained_model: dsl.Input[dsl.Model]
- transformed_eval_data: dsl.Input[dsl.Dataset]
- suffix: str
- Outputs:
- metrics: dsl.Output[dsl.Metrics] (Accuracy metric in Vertex MLMD)
- classification_metrics: dsl.Output[dsl.ClassificationMetrics] (Interactive Confusion Matrix visualized in Vertex AI console)
$ claude mcp add lab_sample_pipelines \
-- python -m otcore.mcp_server <graph>