pythonnumpyscikit-learnsurvival-analysis

concordance index in python


I'm looking for a python/sklearn/lifelines/whatever implementation of Harrell's c-index (concordance index), which is mentioned in random survival forests.

The C-index is calculated using the following steps:

  1. Form all possible pairs of cases over the data.
  2. Omit those pairs whose shorter survival time is censored. Omit pairs i and j if Ti=Tj unless at least one is a death. Let Permissible denote the total number of permissible pairs.
  3. For each permissible pair where Ti and Tj are not equal, count 1 if the shorter survival time has worse predicted outcome; count 0.5 if predicted outcomes are tied. For each permissible pair, where Ti=Tj and both are deaths, count 1 if predicted outcomes are tied; otherwise, count 0.5. For each permissible pair where Ti=Tj, but not both are deaths, count 1 if the death has worse predicted outcome; otherwise, count 0.5. Let Concordance denote the sum over all permissible pairs.
  4. The C-index, C, is defined by C=Concordance/Permissible.

Note: nltk has a ConcordanceIndex method with a different meaning :(


Solution

  • LifeLines package now has this implemented c-index, or concordance-index