![Page 2: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/2.jpg)
About me
Research Fellow at CREST, UCL
Supervisor: Prof. Mark Harman
PHD student of Peking University | Sep, 2015
– June, 2018 | Supervisor : Lu Zhang
Research Interest
https://sites.google.com/view/jie-zhang/home
![Page 3: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/3.jpg)
Why SE ML Matters?
Diversity Matters Different communities: different perspectives
![Page 4: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/4.jpg)
What Can SE Bring to ML?
ML Community
![Page 5: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/5.jpg)
What Can SE Bring to ML?
ML Community
“Analysis destroys wholes. Some things, magic things, are meant to stay whole. If you look at their pieces, they go away.” -- The Bridges of Madison County
![Page 6: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/6.jpg)
What Can SE Bring to ML?
ML Community
SE Community
![Page 7: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/7.jpg)
SE for ML: Where are we now?
ML Community
![Page 8: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/8.jpg)
SE for ML: Can we take another path?
SE Community
ML Community
![Page 9: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/9.jpg)
![Page 10: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/10.jpg)
Number of ML testing publications
trustworthiness
![Page 11: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/11.jpg)
Number of ML testing publications
![Page 12: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/12.jpg)
Definitions of Machine Learning Testing
An ML bug refers to any imperfection in a
machine learning item that causes a discordance between the
existing and the required conditions.
Definition 1 (ML Bug).
Machine Learning Testing (ML testing) refers
to any activities designed to reveal machine learning bugs
Definition 2 (ML Testing).
![Page 13: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/13.jpg)
Comparison between ML testing & software testing
![Page 14: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/14.jpg)
Comparison between ML testing & software testing
![Page 15: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/15.jpg)
Comparison between ML Testing & Software Testing
“There would be no need to write such programs, if the correct answer were known”------- Davis and Weyuker, 1981
![Page 16: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/16.jpg)
Definitions of Machine Learning Testing
An ML bug refers to any imperfection in a
machine learning item that causes a discordance between the
existing and the required conditions.
Definition 1 (ML Bug).
Machine Learning Testing (ML testing) refers
to any activities designed to reveal machine learning bugs
Definition 2 (ML Testing).
![Page 17: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/17.jpg)
ML Testing Workflow
![Page 18: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/18.jpg)
ML Testing Workflow
![Page 19: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/19.jpg)
Definitions of Machine Learning Testing
An ML bug refers to any imperfection in a
machine learning item that causes a discordance between the
existing and the required conditions.
Definition 1 (ML Bug).
Machine Learning Testing (ML testing) refers
to any activities designed to reveal machine learning bugs
Definition 2 (ML Testing).
![Page 20: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/20.jpg)
Components Where the Bug May Exist
![Page 21: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/21.jpg)
Definitions of Machine Learning Testing
An ML bug refers to any imperfection in a
machine learning item that causes a discordance between the
existing and the required conditions.
Definition 1 (ML Bug).
Machine Learning Testing (ML testing) refers
to any activities designed to reveal machine learning bugs
Definition 2 (ML Testing).
![Page 22: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/22.jpg)
ML Properties to TestCorrectness
Overfitting degree
Robustness
Security
Privacy
Fairness
Interpretability
Efficiency
![Page 23: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/23.jpg)
ML Properties to TestCorrectness
Overfitting degree
Robustness
Security
Privacy
Fairness
Interpretability
functional
![Page 24: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/24.jpg)
ML Properties to TestCorrectness
Overfitting degree
Robustness
Security
Privacy
Fairness
Interpretability
Efficiency
non-functional
![Page 25: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/25.jpg)
![Page 26: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/26.jpg)
Testing Workflow
Metamorphic relationsDifferential TestingN-version ProgrammingMetrics
Fuzzing symbolic executionDomain-specific synthesis: GAN
CoverageMutation testing
Input generation
oracle
adequacyevaluation
![Page 27: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/27.jpg)
![Page 28: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/28.jpg)
Supervised/Unsupervised/Reinforcement Learning
![Page 29: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/29.jpg)
Machine Learning Properties
![Page 30: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/30.jpg)
![Page 31: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/31.jpg)
Challenges● Test Input Generation:
○ Safety-critical: Space coverage: enormous behaviour space of ML models
● The Oracle Problem: how to reduce false positives.
● Testing Cost Reduction.
![Page 32: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/32.jpg)
Research Opportunities
● Test Input Generation:
○ Safety-critical: Space coverage
● The Oracle Problem: how to reduce false positives.
● Testing Cost Reduction.
SBST
Testability Transformation(Harman 2004)
![Page 33: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/33.jpg)
Research Opportunities
● Test Input Generation:
○ Safety-critical: Space coverage
● The Oracle Problem: how to reduce false positives.
● Testing Cost Reduction.
Multiple oracles
Metamorphic relation: largely depend on inputs
![Page 34: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/34.jpg)
Research Opportunities
● Test Input Generation:
○ Safety-critical: Space coverage
● The Oracle Problem: how to reduce false positives.
● Testing Cost Reduction.Test-cost reduction Transformation
![Page 35: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/35.jpg)
Research Opportunities
● Unsupervised/reinforcement learning testing
● More machine learning properties: privacy, fairness
● More testing benchmarks
● More testing tools
● More testing activities
![Page 36: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/36.jpg)
![Page 37: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/37.jpg)
Model Selection and Overfitting Problem
Overfitting happens when a model :learns the detail and noise in the training data too well; the noise or random fluctuations in the training data is picked up and learned as concepts by the model.
![Page 38: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/38.jpg)
Existing Research
cross-validation:
test error to approximate the generalisation error.
● test sample may not be be representative● different models may have very similar cross validation results
Applied Machine Learning
VC-dimension and Rademacher Complexity:
● only measure the complexity of the hypothesis space, not the fit
● both quantities are usually intractable in practice,
● Only provide bounds and the bound can be quite loose.
Statistical Machine Learning
![Page 39: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/39.jpg)
Our approach
Create different data versions by injecting noise
Retrain the model on each data version
Observe the decrease of training accuracy
Mutation Metamorphic Relations
![Page 40: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/40.jpg)
![Page 41: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/41.jpg)
![Page 42: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/42.jpg)
On real data sets
![Page 43: Machine Learning Testing jie.zhang@ucl.ac.uk Jie M. Zhang ... - … · Definitions of Machine Learning Testing An ML bug refers to any imperfection in a machine learning item that](https://reader034.vdocuments.mx/reader034/viewer/2022042804/5f5a44655f64351cd516dee0/html5/thumbnails/43.jpg)
● Is now dealing with feedback from authors of the collected papers (have got around 70 responses so far).
● Will be on arXiv very soon.● Feel free to ask for a draft ([email protected])● Any feedback is very welcome!