May we use cookies so Meta, Google, LinkedIn and ChatGPT see your visit and we learn which ads work? PrivacyMay we use cookies to see which pages help, and let Meta, Google, LinkedIn and ChatGPT see your visit, so we know which of our ads work? That way we spend less on ads that do not work. We do not sell your data, and the site works the same if you decline. You can change your answer at any time under Cookie settings at the foot of the page. Privacy policy
Loading...
AI Engineering · Packaging And Registry
Free preview: the first 2 parts of this 28-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
Generative AI and Agentic AI Engineering
Unlock this lesson and the 208 other paid lessons
$35 once, by card or PayPal
See the Generative AI and Agentic AI courseread the rest of this lesson in
Generative AI and Agentic AI Engineering
Unlock this lesson and the 208 other paid lessons
$35 once, by card or PayPal
See the Generative AI and Agentic AI coursein Packaging And Registry
This lesson is part of the AI Engineering course. Unlock the full course, a separate one-time payment, for lifetime access.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime AccessFoundation lessons of this course are free, no payment needed. Try them now
Let me start with a photo, like the one in the picture.
Imagine you have a big, sharp photo of a lake and mountains. You print the same photo much smaller, to fit in a wallet. Almost everything is still there: the lake, the trees, the sky. If you hold the two side by side, you see the same picture.
![]()
But look closely at the small print. Two tiny dots that were separate in the big photo now sit in the same spot, because the small print has fewer dots to work with. Most of the time nobody notices. Once in a while, those two dots were the part that mattered.
A trained model can be "printed smaller" too. In this lesson I copy one real model into a format called ONNX, which stores its numbers with fewer digits. Then I check, row by row, which answers survived.
This lesson uses the model from the features chapter. If it is new to you, please read what a feature is first. That lesson built six features for each customer of a real online shop. It asked one question: at the start of a month, will this customer buy something in the next 30 days? The model is a gradient boosted tree model from scikit-learn, and it scored a test AP of 0.5450. AP, average precision, is a score from 0 to 1 for how well the model ranks the buyers above the others.
Three lessons of this chapter lead here. Saving formats compared saved the model eleven ways, and every file gave back every prediction to the last bit. It ended by saying a conversion to ONNX would open that question again. Library version skew showed that a saved model often breaks when scikit-learn changes, and mentioned ONNX as a way to run a model without scikit-learn, untested. And container images found that moving from a Mac to Linux changed the very last digit of 33 predictions.
Here I test ONNX for real, on the same model and the same rows.