Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-245

Platt Scaling Parameters

Problem

Return the parameters [A, B] of the logistic calibration p = 1 / (1 + exp(-(A * score + B))) placed so the decision boundary sits at the midpoint of the two class means: A = 1 / (mean_pos - mean_neg) and B = -A * (mean_pos + mean_neg) / 2. Return [0.0, 0.0] when either class is empty or the means are equal.

Test cases

case 1
in: [[0.8,0.9],[0.1,0.2]]
expected: [1.4285714285714284,-0.7142857142857142]
case 2
in: [[1],[1]]
expected: [0,0]
case 3
in: [[],[]]
expected: [0,0]
case 4
in: [[0.5,0.7],[0.3,0.5]]
expected: [5.000000000000001,-2.5000000000000004]
Starter codePython
def platt_parameters(pos_scores, neg_scores):
    # Your code here
    pass

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