Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-408

Balanced Accuracy from Rates

Problem

Balanced accuracy averages recall and specificity: (recall + specificity) / 2.

Given the two rates, return the balanced accuracy.

Hint

Each class contributes equally regardless of prevalence.

Test cases

case 1
in: [0.8,0.6]
expected: 0.7
case 2
in: [1,0]
expected: 0.5
case 3
in: [0.9,0.9]
expected: 0.9
Starter codePython
def balanced_accuracy_from_rates(recall, specificity):
    # Your code here
    pass

3 test cases · run your code against them in the editor