0
$\begingroup$

According to Wikipedia, the dprime score (aka 'sensitivity index') can be expressed as

$$ d' = Z(\text{hit rate}) - Z(\text{false alarm rate})$$

hit rate (aka recall aka sensitivity) and false alarm rate (equal to 1-specificity). These quantities are point estimates, that is each is a single scalar between 0 and 1.

Z represents the inverse of the cumulative distribution function of the Gaussian distribution. I don't understand how this is supposed to be computed from a single value. A distribution of hit rates and a distribution of false alarm rates would be needed.

In the Wikipedia article, d-prime is also expressed as the Z score of the area of the receiver-operator characteristic times the square root of two.

$$ d' = \sqrt{2} Z(AUC)$$

Q: Is the use of the Z-score in this notation meant to represent prediction and ground truth values that have been Z-normalized?

Is the code below a valid implementation of dprime?


import numpy as np
from sklearn.metrics import roc_auc_score
from scipy import stats
from scipy.stats import norm
import math
Z = norm.ppf

y_true = np.array([0, 0, 1, 1])
y_pred = np.array([0, 0, 1, 1])
dprime = math.sqrt(2) * Z(roc_auc_score(y_true,y_pred))
print(dprime)

This prints inf, as the classifier has made no errors.

$\endgroup$

1 Answer 1

1
$\begingroup$

In the wikipedia page, it says

... where function Z(p), p ∈ [0,1], is the inverse of the cumulative distribution function of the Gaussian distribution.

So, the input to $Z$ function is a single value in $[0,1]$, which can be hit rate, false alarm rate or AUC, which means you don't need a distribution. It doesn't say but it should be the inverse CDF of standard gaussian.

$\endgroup$
2
  • $\begingroup$ Thanks! Can you please comment on my updated Python code? I used norm.ppf from scipy.stats as Z. $\endgroup$ Oct 19, 2020 at 10:54
  • $\begingroup$ @andandandand you're welcome, it seems correct $\endgroup$
    – gunes
    Oct 19, 2020 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.