All problems
Gini from AUC
Problem
Convert AUC to the Gini coefficient: Gini = 2 * AUC - 1.
Hint
The Gini coefficient rescales AUC so that random is 0 and perfect is 1.
Test cases
case 1
in: [0.5]
expected: 0
case 2
in: [0.7]
expected: 0.3999999999999999
case 3
in: [1]
expected: 1
case 4
in: [0]
expected: -1
Starter codePython
def gini_from_auc(auc):
# Your code here
pass4 test cases · run your code against them in the editor