Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-220

Discriminant Value

Problem

Return the linear discriminant score x.(m1 - m0) - 0.5*(m1.m1 - m0.m0) for a point under the equal-identity-covariance simplification. Return 0.0 when the vector lengths differ.

Hint

Positive scores favor the first class.

Test cases

case 1
in: [[0.5,0.5],[1,1],[0,0]]
expected: 0
case 2
in: [[2,1],[1,1],[0,0]]
expected: 2
case 3
in: [[-1,-1],[1,1],[0,0]]
expected: -3
case 4
in: [[1,1],[2,0],[0,2]]
expected: 0
case 5
in: [[1],[3],[1]]
expected: -2
Starter codePython
def discriminant_value(x, mean1, mean0):
    # Your code here
    pass

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