Learn to make ML training reproducible: seeds, project layout, params files, Optuna tuning, data validation, model tests, and safe model saving.
It is a Tuesday at acme-shop. The risk team's fraud model has been running for four months, and a new engineer is asked to retrain it with fresh data.
Two things make a rerun give a different answer without anyone touching the code: hidden randomness, and a changed environment.
A notebook is a great place to explore. It is a poor place to keep a model that matters.
If you change max_depth by editing a number inside a Python file, you cannot easily compare it with the last run.
A model trained on broken data does not fail. It trains happily and gives bad predictions.
You already know grid search from Machine Learning for AI Engineers. It tries every combination you list.
It is a Tuesday at acme-shop. The risk team's fraud model has been running for four months, and a new engineer is asked...
Two things make a rerun give a different answer without anyone touching the code: hidden randomness, and a changed...
A notebook is a great place to explore. It is a poor place to keep a model that matters.
If you change max_depth by editing a number inside a Python file, you cannot easily compare it with the last run.
A model trained on broken data does not fail. It trains happily and gives bad predictions.
You already know grid search from Machine Learning for AI Engineers. It tries every combination you list.
Python for AI Engineering taught you how to test code.
A trained model is only useful if you can load it again and know what it is. Saving it well takes a few extra lines.
The last piece is making the whole workflow easy to run, and easy to fail loudly.
You will build the project from the pieces above, train a model, prove that a rerun gives the same answer, tune it, and...
Quick reference Common mistakes Training without fixed seeds is the most common cause of results nobody can explain.
Roles that use the skills in this module.
AI Engineer
MLOps Engineer
Platform Engineer
Data Engineer
Not a software engineer sheet. Every problem comes from real DevOps, SRE, Platform and Cloud interviews, from your first script to a system you build yourself.
Open the Coding SheetIt means that when the code, the data, the settings and the software environment are controlled, training gives identical or very close results. If something changes, you can name which input changed. Without that, you cannot trust a comparison between two models, and you cannot rebuild a model that is already in production.
Not always. Some GPU operations and multi-threaded libraries are not exactly repeatable. For classic models on a CPU, such as XGBoost with one thread, fixing the seeds and the environment gives identical results on the same machine. When exact repeats are impossible, aim for results that agree closely and know why they differ.
Use the same pipeline object for both. When preprocessing and the model are saved together as one scikit-learn Pipeline, the code that prepares features during training is the code that runs at prediction time. A test that scores rows one by one and as a batch then catches the remaining differences.
Grid search tries every combination you list, so the number of runs grows fast. Optuna picks the next settings to try based on earlier results, so it usually finds good settings in fewer runs. Both must score on folds of the training data, never on the test set.