{"course":{"slug":"ai-and-you","title":"AI, Safety and What Goes Wrong","url":"https://addaly.com/learn/ai-and-you","level":"beginner","track":"start"},"lesson":{"slug":"the-confusion-matrix-by-group","title":"Counting the four ways to be right and wrong","url":"https://addaly.com/learn/ai-and-you/the-confusion-matrix-by-group","position":11,"of":73,"minutes":9,"answer":"Split every decision into the four outcome boxes and compute the rates separately per group: precision can look nearly equal while the true positive rate differs by a factor of three on the same numbers.","keyIdea":"Split every decision into the four outcome boxes and compute the rates separately per group: precision can look nearly equal while the true positive rate differs by a factor of three on the same numbers."},"body":{"format":"markdown","text":"## An accuracy figure hides the argument\n\n\"The model is 88% accurate\" is the least informative sentence in applied machine learning. It combines two entirely different mistakes into one number, and it averages over groups of people who are experiencing the system very differently.\n\nFor a system that says yes or no, every case falls into one of four boxes. Using a loan model as the example, where \"yes\" means approved and the truth is whether the person would have repaid:\n\n- **True positive**: approved, and would have repaid. The system was right.\n- **False positive**: approved, and would have defaulted. The lender loses money.\n- **False negative**: rejected, and would have repaid. The applicant loses the loan they deserved. The lender never finds out.\n- **True negative**: rejected, and would have defaulted. Right again.\n\nNow compute them separately for each group of people, and the argument becomes visible.\n\n## A worked example, with the arithmetic shown\n\nTwo groups, a thousand applicants each. The model is applied identically to both.\n\n**Group A.** Approved and repaid: 630. Approved and defaulted: 70. Rejected who would have repaid: 90. Rejected who would have defaulted: 210.\n\n**Group B.** Approved and repaid: 350. Approved and defaulted: 50. Rejected who would have repaid: 150. Rejected who would have defaulted: 450.\n\n> Figure: Group B: 1,000 applicants, one loan model. A two by two grid, rows Would have repaid and Would have defaulted, columns Approved and Rejected: Would have repaid and Approved: 350; Would have repaid and Rejected: 150; Would have defaulted and Approved: 50; Would have defaulted and Rejected: 450. True positive rate 350 ÷ 500 = 70%, against 87.5% for Group A. Precision 350 ÷ 400 = 87.5%, against 90%. The same four boxes support 'an approval means the same thing for everyone' and 'a qualified Group B applicant is nearly three times as likely to be refused'.\n\nNow four rates, each answering a different question.\n\n**Approval rate**: of everyone who applied, who got a loan. Group A: 700 of 1,000, so 70%. Group B: 400 of 1,000, so 40%.\n\n**True positive rate**, also called recall or sensitivity: of the people who *would have repaid*, who got approved. Group A: 630 of 720, so 87.5%. Group B: 350 of 500, so 70%. This is the rate that matters to a creditworthy applicant. Being in Group B and deserving a loan means a 30% chance of refusal, against 12.5% in Group A.\n\n**False positive rate**: of the people who *would have defaulted*, who got approved anyway. Group A: 70 of 280, so 25%. Group B: 50 of 500, so 10%.\n\n**Precision**, or positive predictive value: of the people the model approved, who actually repaid. Group A: 630 of 700, so 90%. Group B: 350 of 400, so 87.5%.\n\nOn precision the two groups are almost identical: 90% against 87.5%. A lender could truthfully say \"an approval means the same thing regardless of group\". On the true positive rate they are not remotely identical: a qualified Group B applicant is nearly three times as likely to be turned away.\n\nThis is not a hypothetical construction. It is the exact structure of the argument about the COMPAS recidivism tool, which [Why you cannot have all three](/learn/ai-and-you/why-you-cannot-have-all-three) takes apart.\n\n## Which rate belongs to whom\n\nThe reason people talk past each other is that each rate answers the question of a different party.\n\nThe **institution** cares about precision and about the false positive rate, because those are its losses. The **individual who was rejected** cares about the false negative rate, because that is their harm. The **regulator** often looks at the approval rate, because that is what shows up as an outcome gap in the population. A **defendant** in a risk-scoring system cares about being wrongly labelled high risk, which is a false positive in that framing.\n\nNone of these people is confused. They are computing different fractions of the same table, and the fractions disagree.\n\n## How to do this yourself\n\nYou need three columns: the group, the model's decision, and what actually happened. Then count. In a spreadsheet this is a pivot table and takes ten minutes. In Python it is a couple of lines with pandas, free and running on any laptop:\n\n```python\nimport pandas as pd\ndf = pd.read_csv(\"decisions.csv\")\ntab = df.groupby([\"group\", \"decision\", \"outcome\"]).size()\nprint(tab)\n```\n\nYou know what actually happened only for people the system said yes to: the rejected applicant never gets the chance to repay. That gap has a name, the selective labels problem, and it has a lesson of its own: [The outcomes you never get to see](/learn/ai-and-you/the-feedback-loop-in-data).\n\nOne discipline before you start: decide which rate you will report *before* you compute all four. Otherwise you will compute four, find the one that looks best, and report that, and you will do it without noticing."},"check":{"question":"Of 500 Group B applicants who would have repaid, 350 were approved. Of 400 Group B applicants approved, 350 repaid. A lender reports \"our approvals are equally reliable for both groups\" and a campaigner reports \"qualified Group B applicants are turned away three times as often\". Who is computing what?","options":[{"text":"The lender is computing accuracy and the campaigner the approval rate for Group B","correct":false,"tempting":"Names two plausible metrics, but not the pair behind this dispute. Accuracy averages the boxes rather than separating them."},{"text":"Lender: precision, 350 of 400 repaid. Campaigner: false negatives, 150 of 500 refused","correct":true},{"text":"The campaigner is right, because precision can always be equalised by moving the threshold","correct":false,"tempting":"Treats one side as mistaken when both fractions come from the same table. A threshold moves all the rates together."},{"text":"They must be using different data, and one shared dataset would settle the dispute","correct":false,"tempting":"Assumes the disagreement is about data, when both figures come from the same four counts and survive perfect agreement on them."}],"why":"Both figures are correct. They divide the same table in different directions."},"prev":{"slug":"where-bias-comes-from","title":"Where bias comes from","url":"https://addaly.com/learn/ai-and-you/where-bias-comes-from"},"next":{"slug":"three-definitions-of-fair","title":"Three definitions of fair, stated precisely","url":"https://addaly.com/learn/ai-and-you/three-definitions-of-fair"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Source and assessment review continues. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Counting the four ways to be right and wrong', in AI, Safety and What Goes Wrong. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/ai-and-you/the-confusion-matrix-by-group (Accessed: 29 November 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Counting the four ways to be right and wrong","courseTitle":"AI, Safety and What Goes Wrong","module":{"index":2,"slug":"bias-and-fairness","title":"Bias, and how to measure it"},"answer":null,"keyIdea":"Split every decision into the four outcome boxes and compute the rates separately per group: precision can look nearly equal while the true positive rate differs by a factor of three on the same numbers.","hero":{"kind":"figure","figure":{"t":"figure","label":"Figure","figure":{"caption":"True positive rate 350 ÷ 500 = 70%, against 87.5% for Group A. Precision 350 ÷ 400 = 87.5%, against 90%. The same four boxes support ‘an approval means the same thing for everyone’ and ‘a qualified Group B applicant is nearly three times as likely to be refused’.","cellLabels":[["true positives","false negatives"],["false positives","true negatives"]],"cells":[["350","150"],["50","450"]],"cols":["Approved","Rejected"],"rows":["Would have repaid","Would have defaulted"],"title":"Group B: 1,000 applicants, one loan model","type":"matrix"},"alt":"Figure: Group B: 1,000 applicants, one loan model. A two by two grid, rows Would have repaid and Would have defaulted, columns Approved and Rejected: Would have repaid and Approved: 350; Would have repaid and Rejected: 150; Would have defaulted and Approved: 50; Would have defaulted and Rejected: 450. True positive rate 350 ÷ 500 = 70%, against 87.5% for Group A. Precision 350 ÷ 400 = 87.5%, against 90%. The same four boxes support ‘an approval means the same thing for everyone’ and ‘a qualified Group B applicant is nearly three times as likely to be refused’."}},"blocks":[{"t":"h2","id":"an-accuracy-figure-hides-the-argument","runs":[{"text":"An accuracy figure hides the argument"}]},{"t":"p","runs":[{"text":"“The model is 88% accurate” is the least informative sentence in applied machine learning. It combines two entirely different mistakes into one number, and it averages over groups of people who are experiencing the system very differently."}]},{"t":"p","runs":[{"text":"For a system that says yes or no, every case falls into one of four boxes. Using a loan model as the example, where “yes” means approved and the truth is whether the person would have repaid:"}]},{"t":"ul","items":[[{"text":"True positive","b":true},{"text":": approved, and would have repaid. The system was right."}],[{"text":"False positive","b":true},{"text":": approved, and would have defaulted. The lender loses money."}],[{"text":"False negative","b":true},{"text":": rejected, and would have repaid. The applicant loses the loan they deserved. The lender never finds out."}],[{"text":"True negative","b":true},{"text":": rejected, and would have defaulted. Right again."}]]},{"t":"p","runs":[{"text":"Now compute them separately for each group of people, and the argument becomes visible."}]},{"t":"h2","id":"a-worked-example-with-the-arithmetic-shown","runs":[{"text":"A worked example, with the arithmetic shown"}]},{"t":"p","runs":[{"text":"Two groups, a thousand applicants each. The model is applied identically to both."}]},{"t":"p","runs":[{"text":"Group A.","b":true},{"text":" Approved and repaid: 630. Approved and defaulted: 70. Rejected who would have repaid: 90. Rejected who would have defaulted: 210."}]},{"t":"p","runs":[{"text":"Group B.","b":true},{"text":" Approved and repaid: 350. Approved and defaulted: 50. Rejected who would have repaid: 150. Rejected who would have defaulted: 450."}]},{"t":"p","runs":[{"text":"Now four rates, each answering a different question."}]},{"t":"p","runs":[{"text":"Approval rate","b":true},{"text":": of everyone who applied, who got a loan. Group A: 700 of 1,000, so 70%. Group B: 400 of 1,000, so 40%."}]},{"t":"p","runs":[{"text":"True positive rate","b":true},{"text":", also called recall or sensitivity: of the people who "},{"text":"would have repaid","i":true},{"text":", who got approved. Group A: 630 of 720, so 87.5%. Group B: 350 of 500, so 70%. This is the rate that matters to a creditworthy applicant. Being in Group B and deserving a loan means a 30% chance of refusal, against 12.5% in Group A."}]},{"t":"p","runs":[{"text":"False positive rate","b":true},{"text":": of the people who "},{"text":"would have defaulted","i":true},{"text":", who got approved anyway. Group A: 70 of 280, so 25%. Group B: 50 of 500, so 10%."}]},{"t":"p","runs":[{"text":"Precision","b":true},{"text":", or positive predictive value: of the people the model approved, who actually repaid. Group A: 630 of 700, so 90%. Group B: 350 of 400, so 87.5%."}]},{"t":"p","runs":[{"text":"On precision the two groups are almost identical: 90% against 87.5%. A lender could truthfully say “an approval means the same thing regardless of group”. On the true positive rate they are not remotely identical: a qualified Group B applicant is nearly three times as likely to be turned away."}]},{"t":"p","runs":[{"text":"This is not a hypothetical construction. It is the exact structure of the argument about the COMPAS recidivism tool, which "},{"text":"Why you cannot have all three","href":"https://addaly.com/learn/ai-and-you/why-you-cannot-have-all-three"},{"text":" takes apart."}]},{"t":"h2","id":"which-rate-belongs-to-whom","runs":[{"text":"Which rate belongs to whom"}]},{"t":"p","runs":[{"text":"The reason people talk past each other is that each rate answers the question of a different party."}]},{"t":"p","runs":[{"text":"The "},{"text":"institution","b":true},{"text":" cares about precision and about the false positive rate, because those are its losses. The "},{"text":"individual who was rejected","b":true},{"text":" cares about the false negative rate, because that is their harm. The "},{"text":"regulator","b":true},{"text":" often looks at the approval rate, because that is what shows up as an outcome gap in the population. A "},{"text":"defendant","b":true},{"text":" in a risk-scoring system cares about being wrongly labelled high risk, which is a false positive in that framing."}]},{"t":"p","runs":[{"text":"None of these people is confused. They are computing different fractions of the same table, and the fractions disagree."}]},{"t":"h2","id":"how-to-do-this-yourself","runs":[{"text":"How to do this yourself"}]},{"t":"p","runs":[{"text":"You need three columns: the group, the model’s decision, and what actually happened. Then count. In a spreadsheet this is a pivot table and takes ten minutes. In Python it is a couple of lines with pandas, free and running on any laptop:"}]},{"t":"code","lang":"python","label":"Python","text":"import pandas as pd\ndf = pd.read_csv(\"decisions.csv\")\ntab = df.groupby([\"group\", \"decision\", \"outcome\"]).size()\nprint(tab)"},{"t":"p","runs":[{"text":"You know what actually happened only for people the system said yes to: the rejected applicant never gets the chance to repay. That gap has a name, the selective labels problem, and it has a lesson of its own: "},{"text":"The outcomes you never get to see","href":"https://addaly.com/learn/ai-and-you/the-feedback-loop-in-data"},{"text":"."}]},{"t":"p","runs":[{"text":"One discipline before you start: decide which rate you will report "},{"text":"before","i":true},{"text":" you compute all four. Otherwise you will compute four, find the one that looks best, and report that, and you will do it without noticing."}]}],"check":{"question":[{"text":"Of 500 Group B applicants who would have repaid, 350 were approved. Of 400 Group B applicants approved, 350 repaid. A lender reports “our approvals are equally reliable for both groups” and a campaigner reports “qualified Group B applicants are turned away three times as often”. Who is computing what?"}],"options":[{"text":[{"text":"The lender is computing accuracy and the campaigner the approval rate for Group B"}],"correct":false,"tempting":[{"text":"Names two plausible metrics, but not the pair behind this dispute. Accuracy averages the boxes rather than separating them."}]},{"text":[{"text":"Lender: precision, 350 of 400 repaid. Campaigner: false negatives, 150 of 500 refused"}],"correct":true,"tempting":null},{"text":[{"text":"The campaigner is right, because precision can always be equalised by moving the threshold"}],"correct":false,"tempting":[{"text":"Treats one side as mistaken when both fractions come from the same table. A threshold moves all the rates together."}]},{"text":[{"text":"They must be using different data, and one shared dataset would settle the dispute"}],"correct":false,"tempting":[{"text":"Assumes the disagreement is about data, when both figures come from the same four counts and survive perfect agreement on them."}]}],"order":[2,0,1,3],"why":[{"text":"Both figures are correct. They divide the same table in different directions."}]},"prev":{"slug":"where-bias-comes-from","title":"Where bias comes from","minutes":9},"next":{"slug":"three-definitions-of-fair","title":"Three definitions of fair, stated precisely","minutes":9}}}