Machine Learning Mischief: Examples from the dark side of data science

Machine Learning Mischief
Do not do this!!!
It is possible to "bend" machine learning experiments towards achieving a preconceived goal.
This involves systematically exploiting evaluation metrics and/or scientific tests to achieve desired outcomes without actually meeting the underlying scientific objectives.
These behaviors are unethical and might be called cherry picking, data dredging, or gaming results.
Reviewing examples of this type of "gaming" (data science dark arts) can remind beginners and stakeholders (really all of us!) why certain methods are best practices and how to avoid being deceived by results that are too good to be true.
Examples
Below are examples of this type of gaming, and simple demonstrations of each:
- Seed Hacking: Repeat an experiment with different random number seeds to get the best result.
- p-Hacking: Repeat a statistical hypothesis test until a significant result is achieved.
- Test Harness Hacking: Varying models and hyperparameters to maximize test harness performance._
- Test Set Memorization: Allow the model to memorize the test set and get a perfect score._
- Test Set Overfitting: Optimizing a model for its performance on a "hold out" test set._
- Test Set Pruning: Remove hard-to-predict examples from the test set to improve results._
- Train/Test Split Ratio Gaming: Vary train/test split ratios until a desired result is achieved.
- Leaderboard Hacking: Issue predictions for a machine learning competition until a perfect score is achieved.
- Threshold Hacking: Adjusting classification thresholds to hit specific metric targets.
How To Spot
Results presented using these methods are easy to spot with probing questions:
- "Why did you use such a specific random number seed?"
- "Why did you choose this split ratio over other more common ratios?"
- "Why did you remove this example from the test set and not that example?"
- "Why didn't you report a performance distribution over repeated resampling of the data?"
DO NOT DO THIS
This project is for educational purposes only!
If you use these methods on a project, you're unethical, a fraud, and your results are garbage.
Also, results/models will be fragile and will not generalize to new data in production or a surprise/hidden test set. You will be found out. A competent senior data scientist (or LLM?) will see what is up very quickly.
So why give examples?
I've never seen anything like this for machine learning and data science. Yet, most experienced practitioners know that they are a real thing.
Knowing what-to-look-for can help stakeholders, managers, teachers, paper reviews, etc.
Knowing what-not-to-do can help junior data scientists.
Also, thinking about and writing these examples feels naughty + fun :)
More
If you like this project, you may be interested in Data Science Diagnostics.
If you have ideas for more examples, email me: Jason.Brownlee05@gmail.com