mlflow-experience¶
A simple, configuration-driven MLOps pipeline built with Scikit-Learn, Pydantic, and MLflow.
Welcome to mlflow-experience! This project lets you build, train, evaluate, and track machine learning experiments without writing boilerplate code. Instead of editing Python scripts every time you want to try a new feature, a different scaler, or a new model, you define your experiment in a YAML configuration file.
Why Use This Project?¶
- No Manual Glue Code: Define your data source, preprocessing steps, model type, and hyperparameters in YAML.
- No Data Leakage: Transformations (like scalers, encoders, and imputers) learn their parameters only on the training set and apply them safely to the test set.
- DataFrames Stay DataFrames: We use Scikit-Learn's
transform_output="pandas"so column names are never lost during preprocessing. - Automatic MLflow Tracking: Your hyperparameters, evaluation metrics, model files, and console logs are automatically saved to MLflow.
- Type Safety with Pydantic: Your YAML configuration is checked before running. If a column name is missing or a strategy typo exists, it fails immediately with a clear error.
Quick Example¶
Here is how simple an experiment looks in YAML:
# configs/mvp.yaml (snippet)
dataset:
train:
type: csv
path: data/raw/churn_train.csv
target_column: Churn
id_column: CustomerID
preprocessing:
- name: handle_missing
type: missing
params:
columns:
- name: Age
strategy: mean
- name: scale_features
type: scaling
params:
columns:
- name: Age
strategy: standard
model:
type: logistic_regression
task: 'binary:classification'
hyperparameters:
max_iter: 250
Run this in your terminal:
The pipeline loads the data, cleans missing values, scales features, fits a logistic regression model, evaluates accuracy and F1 score, and logs the run to MLflow.
How It Works¶
graph LR
Config[YAML Config] --> Validator[Pydantic Validation]
Validator --> Loader[Data Loader & Splitter]
Loader --> Preprocessor[Preprocessing Pipeline]
Preprocessor --> Model[Model Estimator]
Model --> Evaluator[Evaluation Metrics]
Evaluator --> MLflow[MLflow Tracking & Artifacts]
Documentation Guide¶
- Installation: Set up Python,
uv, and dependencies in under 2 minutes. - Quickstart Guide: Run your first experiment step-by-step.
- How-To Guides: Task-oriented recipes for common scenarios (custom datasets, missing data, scaling, offline tracking).
- Project Tour: Walk through every file and folder in the repository.
- Architecture: Understand how the 5 layers and the
Orchestratorwork. - YAML Configuration: Full reference for all configuration options.
- Transformers Reference: See before & after examples for all preprocessing steps.
- MLflow Tracking: How to view your experiment results in the MLflow UI.
- Troubleshooting & FAQ: Quick solutions for common errors.