A classifier can score well in a notebook but fail months later because customer behavior changes. Training a model once is not the end of its life. MLOps combines machine-learning work with practices for reproducible delivery and ongoing operation.
Follow one model from idea to operation
Imagine a college predicting which courses need additional teaching assistants. The team must define the target, collect historical enrollment data, establish an evaluation baseline, train candidate models, deploy a selected model, and monitor whether predictions remain useful.
A typical lifecycle is problem definition → data preparation → experimentation → validation → release → monitoring → revision. Teams revisit earlier stages when the evidence changes.
What makes ML different from ordinary software delivery?
A conventional program’s logic is primarily written in code. An ML model’s behavior also depends on the training dataset and learned parameters. Reproducing a prediction therefore requires knowing more than the Git commit: data version, preprocessing, random seeds, environment, model artifact, and configuration can matter.
| Stage | Important question | Retained artifact |
|---|---|---|
| Formulate | What outcome matters and what errors cost most? | Problem definition and baseline |
| Collect | Is this data representative and permitted? | Dataset version and provenance |
| Train | Which recipe produced these parameters? | Run configuration, metrics, weights |
| Evaluate | Does it generalize to unseen cases? | Test report and slice-level metrics |
| Release | Can the application load this version safely? | Registry entry and serving package |
| Monitor | Is the model still reliable? | Telemetry and incident records |
Build a repeatable pipeline
Instead of manually running notebook cells in an uncertain order, isolate stages with explicit inputs and outputs. Typical pipeline tasks include validating input data, fitting preprocessors on training data, training a model, calculating evaluation metrics, and packaging artifacts. Pipelines should fail when input contracts are violated rather than silently passing bad data.
Automated pipelines do not eliminate human judgment. A high-stakes or significantly changed model may need approval before deployment. A clean separation between training, validation, and test data prevents false confidence from leakage.
Experimentation and model promotion
Track the goal of each run, parameters, dataset snapshot, evaluation split, metrics, and resulting model file. Compare candidates against a baseline and select models using the metrics appropriate to the problem. Avoid repeatedly tuning against the final test set; doing so turns it into another validation set.
Model promotion should require explicit checks: data-schema compatibility, performance thresholds, responsible-use assessment, resource estimates, and serving compatibility. A model registry records versions and promotion status. A canary deployment initially routes limited traffic to a new version; a rollback restores a known-good version if necessary.
Monitoring closes the loop
Watch both software metrics (errors, latency, memory) and ML metrics (feature distributions, prediction distributions, labels and eventual model accuracy). Often ground-truth labels arrive days or weeks later. Monitor proxy signals early, but do not treat them as a substitute for measured accuracy.
When performance deteriorates, investigate root causes before retraining. A data-collection bug, new business policy, or target-definition change can invalidate historical training data. Retraining automatically on corrupted data only reproduces the error at scale.
Small example: recording experiment metadata
The following uses ordinary JSON as a teaching example. Production experiment trackers add run identifiers, artifact stores, permissions, and search.
import json
from pathlib import Path
run = {
'dataset_version': 'enrollment-2026-v1',
'split_seed': 42,
'algorithm': 'RandomForestRegressor',
'parameters': {'n_estimators': 100, 'random_state': 42},
'validation_mae': 8.2,
'code_revision': 'record-a-real-git-commit-here',
}
Path('run_metadata.json').write_text(json.dumps(run, indent=2))
The values are illustrative, not results of a trained model. Saving a metadata file is a start, not a complete reproducibility guarantee: retain the actual data and environment references too.
Related concepts
- Data Splitting, Labeling, and Leakage
- Evaluating Machine Learning Models
- Data, Model, and Experiment Versioning
- Monitoring, Data Drift, and Concept Drift
References
Related articles in
- Clustering and K-Means — Learn how unsupervised clustering discovers groups in data, how K-Means optimizes cluster centroids, and how to evaluate and use its results responsibly.
- Data, Model, and Experiment Versioning — Learn to trace ML results to exact datasets, code revisions, configurations, and artifacts.
- Decision Trees, Random Forests, and Boosting — Learn how decision trees partition data, how random forests reduce variance through bagging, and how boosting combines sequential learners to improve predictions.