Complete the code to calculate the accuracy of a model.
accuracy = correct_predictions / [1]Accuracy is the number of correct predictions divided by the total number of predictions made.
Complete the code to calculate demographic parity difference between two groups.
dp_difference = abs(rate_group1 - [1])Demographic parity difference is the absolute difference between positive rates of two groups.
Fix the error in the code to compute equal opportunity difference.
equal_opportunity_diff = tpr_group1 - [1]Equal opportunity difference compares true positive rates (TPR) between groups.
Fill both blanks to calculate disparate impact ratio.
disparate_impact = [1] / [2]
Disparate impact is the ratio of positive rates between minority and majority groups.
Fill all three blanks to create a fairness report dictionary.
fairness_report = {
'demographic_parity_diff': [1],
'equal_opportunity_diff': [2],
'disparate_impact': [3]
}The fairness report includes demographic parity difference, equal opportunity difference, and disparate impact metrics.