Concordance Index¶
-
evaluations.medical.concordance_index.concordance_index(events: List[int], risks: List[float]) → float¶ Compute Concordance index (C-index)
The concordance index is a value between 0 and 1 where:
1.0 - all risk scores for happened events higher than for unhappened,
0.0 - all risk scores for unhappened events higher than for happened,
0.5 - random risk scores.
The formula is:
\[C\mbox{-}Index = \frac{n\_concordant\_pairs + 0.5 * n\_risk\_ties}{n\_permissible\_pairs}\]where:
n_concordant_pairs - number of permissible pairs where the score is bigger for the event with label 1 than 0
n_risk_ties - number of permissible pairs with equal scores
n_permissible_pairs - number of pairs with different events
- Parameters
events (List[int]) – If the some event happened - 1 or not happened - 0
risks (List[int]) – Risks scores for each event
- Returns
Concordance index
- Return type
float
Examples
>>> from evaluations.medical import concordance_index >>> events = [1, 0, 1, 1, 0] >>> risks = [0.8, 0.43, 0.62, 0.58, 0.62] >>> concordance_index(events, risks) 0.75