Data models and responsible machine learning
引入| English | 释义 | 拼音 |
|---|---|---|
| training data/ˈtreɪnɪŋ ˈdeɪtə/ | 训练数据 | xùn liàn shù jù |
| machine learning/məˈʃiːn ˈlɜːnɪŋ/ | 机器学习 | jī qì xué xí |
| supervised learning/ˈsuːpəvaɪzd ˈlɜːnɪŋ/ | 监督学习 | jiān dū xué xí |
| precision/prɪˈsɪʒn/ | 精确率 | jīng què lǜ |
| recall/ˈriːkɔːl/ | 召回率 | zhào huí lǜ |
A hiring model that learned a bias, 2018
- In 2018 Reuters reported that Amazon had abandoned an experimental tool for rating job applicants. It had learned from ten years of past résumés, most from men, and began to mark down résumés containing the word "women's", as in "women's chess club captain".
- The model was doing exactly what it was trained to do: copy patterns in its training data 训练数据. Machine learning 机器学习 finds patterns in data; it does not know which patterns are fair.
Why did Amazon's experimental tool mark down some résumés?
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
It copied patterns in its training data.
Kinds of learning
- Supervised learning 监督学习: labelled examples (email → spam or not). Unsupervised: find groups without labels. Reinforcement: learn from rewards.
- Training data teaches; separate test data checks performance on new cases.
Match each task to a kind of learning.
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
Labels, groups, rewards.
Accuracy can mislead
- If 90 of 100 cases are the majority class, a model that always predicts "majority" scores 90% accuracy and finds none of the minority.
- Use a confusion matrix: true and false positives and negatives.
90 of 100 cases are the majority class. What accuracy (%) does a model get by always predicting the majority?
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
It finds none of the minority.
Precision and recall
- Precision 精确率 = TP ÷ (TP + FP): of the cases flagged, how many were right.
- Recall 召回率 = TP ÷ (TP + FN): of the real cases, how many were found.
准确率与类别分布
比较总体准确率、各类别召回率与正类精确率。不同分母回答不同的问题,类别分布会影响总体准确率。
What does recall measure?
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
TP ÷ (TP + FN).
Worked example: a fraud detector
Test set: 1,000 transactions, 20 frauds. The model flags 25; 15 of them are fraud.
- TP = 15, FP = 10, FN = 5, TN = 970.
- Accuracy = (15 + 970) ÷ 1,000 = 98.5%. Precision = 15 ÷ 25 = 60%. Recall = 15 ÷ 20 = 75%.
- Judgement: 98.5% sounds excellent, but a quarter of frauds are missed and 40% of alerts are false. Whether that is acceptable depends on the cost of each error.
A model finds 30 of 40 real cases and makes 20 false alarms. What is its precision in %?
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
30 ÷ (30 + 20) = 60%.
Responsible use
- Check training data for under-represented groups; test performance separately for each group.
- Overfitting: a model that memorises training data performs badly on new data.
An overfitted model performs well on new data.
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
It memorises training data.
High accuracy does not mean a fair or useful model. With imbalanced classes, report precision and recall, and check whether errors fall unfairly on one group.
A model with 98% accuracy must be fair.
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
Check errors by group.
Machine learning copies patterns in training data, including biased ones. Test on unseen data, use a confusion matrix, report precision and recall as well as accuracy, and check errors group by group.
A school proposes a model to predict which students will fail. Explain two risks and how you would test the model responsibly.
Data, errors, testing.