Compute specificity and sensitivity at certain thresholds I have the following table with predictive probabilities and true class labels:

\begin{array}{|c|c|c|c|}
\hline
P(T=1) &amp;0.54&amp; 0.23 &amp; 0.78 &amp; 0.88 &amp; 0.26 &amp; 0.41 &amp; 0.90 &amp; 0.45&amp;0.19&amp;0.36 \\ \hline
 T&amp;1&amp;0 &amp;0 &amp;1 &amp;0 &amp;0&amp; 1&amp; 1&amp; 0&amp; 0\\ \hline
\end{array}

The question is to compute the specificity &amp; sensitivity at the threshold of 0.5.



My attempt at answering this question:

Sensitivity = true positive rate[P(T=1) > 0.5]

= (0.54 + 0.88 + 0.9)/4 = 0.58

Specificity = 1-false positive rate[P(T=1) > 0.5]

= 1- [(0.78)/6]
 = 0.87

Not sure if my working above is correct. I would appreciate if someone can guide me to the correct solution. Thanks.
For threshold = $0.5$ we have:

Sensitivity = True Positive Rate   

= (number of points with label $1$ and $P(T = 1)\geq 0.5$) divided by (number of points with label $1$)    

= $\left|\{(1, 0.54), (1, 0.88), (1, 0.90)\}\right| / 4$ = $3/4$ = $0.75$

Specificity = 1 - False Positive Rate    

= 1 - (number of points with label $0$ and $P(T = 1)\geq 0.5$) divided by (number of points with label $0$)    

= $1 - \left|\{(0, 0.78)\}\right|/6$ =  $1 - 1/6$ = $0.833$