MLOps Notes
MLOps Notes
io/post/mlops1/
1 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
Data drift: the input data has changed. The distribution of the variables is
meaningfully different. As a result, the trained model is not relevant for this new
data.
Concept drift occurs when the patterns the model learned no longer hold.
• Realtime of Batch
• Cloud vs. Edge/Browser
• Compute resources (CPU/GPU/memory)
• Latency, throughput (QPS)
• Logging
• Security and privacy
1. New product/capability
2. Automate/assist with manual task
3. Replace previous ML system
Key idesa:
2 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
• Manual retraining
• Automatic retraining
3 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
• Monitor
◦ Software metrics
◦ Input metrics
◦ Output metrics
• How quickly do they change?
◦ User data generally has slower drift.
◦ enterprise data (B2B applications) can shift fast.
• Machine Learning in Production: Why You Should Care About Data and
Concept Drift
• Monitoring Machine Learning Models in Production
• A Chat with Andrew on MLOps: From Model-centric to Data-centric AI
4 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
Should you take into account deployment constraints when picking a model?
5 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
Skewed datasets
6 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
Performance auditing
7 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
Data iteration
• Model-centric view: take the data you have, and develop a model that does
as well as possible on it.
◦ Hold the data �xed and iteratively improve the code/model.
• Data-centric view: the quality of the data is paramount. Use tools to
improve the data quality; this will allow multiple models to do well.
◦ Hold the code �xed and iteratively improve the data.
• Goal:
◦ Create realistic examples that (i) the algorithm does poorly on, but (ii)
humans (or other baseline) do well on
• Checklist:
◦ Does it sound realistic?
◦ Is the x→ y mapping clear? (e.g. can humans recognize speech?)
◦ Is the algorithm currently doing poorly on it?
8 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
9 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
◦ Product recommendation:
Collaborative �ltering ——> Content based �ltering (cold-start)
• Error analysis can be harder if there is not good baseline (such as HLP) to
compare to.
• Error analysis, user feedback and benchmarking to competitors can all
provide inspiration for features to add.
1. What to track?
◦ Algorithm/code versioning
◦ Dataset used
◦ Hyperparameters
◦ Results
2. Tracking tools
◦ Text �les
◦ spreadsheet
◦ Experiment tracking system
3. Desirable features
◦ Information needed to replicate results
◦ Experiment results, ideally with summary metrics/analysis
◦ Perhaps also: resource monitoring, visualization, model error analysis
Good data:
• Establishing a baseline
• Error analysis
10 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
Error analysis
• Experiment tracking
• Unstructured data
◦ may or may not have huge collection of unlabeled examples x.
◦ Humans can label more data.
◦ Data augmentation more likely to be helpful.
• Structured data
◦ May be more di�cult to obtain more data.
◦ Human labelling may not be possible (with some exceptions)
• Small data
◦ Clean labels are critical
◦ Can manually look through dataset and �x labels
◦ Can get all the labelers to talk to each other
• Big data
Emphasis data process
11 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
Problems with a large dataset but where there’s a long tail or rare events in the
input will have small data challenges too.
• Web search
• Self-driving cars
• Product recommendation systems
12 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
• Small data
◦ Usually small number of labelers
◦ Can ask labelers to discuss speci�c labels
• Big data
◦ Get to consistent de�nition with a small group.
◦ Then send labeling instructions to labelers.
◦ Can consider having multiple labelers label every example and using
voting or consensus labels to increase accuracy.
Estimate Bayes error / irreducible error to help with error analysis and
prioritization.
13 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
When the ground truth label is externally de�ned, HLP gives an estimate for
Bayes error / irreducible error.
• When the label y comes from a human label, HLP « 100% may indicate
ambiguous labeling instructions.
• Improving label consistency will raise HLP
• This makes it harder for ML to beat HLP. But the more consistent labels
will raise ML performance, which is ultimately likely to bene�t the actual
application performance.
Structured data problems are less likely to involve human labelers, thus HLP is
less frequently used.
Some exceptions:
14 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
• POC(proof-of-concept):
◦ Goal is to decide if the application is workable and worth deploying.
◦ Focus on getting the prototype to work
◦ It’s ok if data pre-processing is manual. But take extensive notes/
comments
• Production phase:
• After project utility is established, use more sophisticated tools to make
sure the data pipeline is replicable.
• E.g., Tensor Flow Transform, Apache Beam, Air�ow, …
15 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
• Examples:
◦ Manufacturing visual inspection: time, factory, line #, camera
settings, phone model, inspector ID,…
◦ Speech recognition: device type, labeler ID, VAD model ID,…
• Useful for:
◦ Error analysis. Spotting unexpected effects.
◦ Keeping track of data provenance.
• Train/dev/test: 60%/20%/20%
• Random split: positive example: 21/2/7 (35%/10%/35%)→ dev set is not
representative
• Want: 18/6/6 (30%/30%/30%) →balanced split
• No need to worry about this with large datasets - a random split will be
representative
Scooping
16 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
Criteria: can a human, given the same data, perform the task?
17 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
Key speci�cations:
Label ambiguity
https://arxiv.org/pdf/1706.06969.pdf
Data pipelines
Data lineage
MLops
Overall resources:
Konstantinos, Katsiapis, Karmarkar, A., Altay, A., Zaks, A., Polyzotis, N., … Li, Z.
(2020). Towards ML Engineering: A brief history of TensorFlow Extended (TFX).
http://arxiv.org/abs/2010.02013
PhD Candidate
18 of 19 7/22/24, 12:11
Notes for Introduction to Machine Learning in Production (MLOps1) on Coursera/De... https://zhaoyufei.rbind.io/post/mlops1/
0 Comments
1 Login
Name
Yufei Zhao ©2022 · Code with � and �. Powered by R Blogdown and the Academic theme for Hugo.
19 of 19 7/22/24, 12:11