CourseAI Engineering: The Complete Course · Module 3: Machine Learning Basics · part 25 of 105
Part 25 · Module 3: Machine Learning Basics

Lesson 4: One object you can fit, test, save and hand over

16 min read·13 Oct 2026
Module 3 · Lesson 4 · About 30 minutes · Needs: Lessons 1 to 3 of this module (splits, logistic regression, accuracy)

The situation

Dev wants the ticket classifier behind an internal endpoint, so the support tool can ask it for a category. "Send me the model," he says. You look at your notebook. The model is a logistic regression. It only understands word scores, and those come from a vectoriser fitted in a different cell. Send one without the other and the predictions are wrong, and nothing says so.

DEV: "SEND ME THE MODEL" your notebook vectoriser fitted in cell 3 classifier fitted in cell 7 only works as a pair, in this order ? Dev's service /classify endpoint
Dev wants one model file. The notebook holds two fitted objects (amber: anything learned from data) that only work as a pair, in one order, and nothing enforces either. Blue is your code and the normal path.

This lesson shows how scikit-learn is organised, then packs every step into one object that can be fitted, cross-validated, saved and loaded by Dev. The data is the same 40 labelled tickets, and one new ticket from Aisha Rahman is traced through every step: "My vacuum dock stopped working after six months."

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.