About the CIndex
chengjianhong opened this issue · 1 comments
chengjianhong commented
Is there an error in this function? The elif hazards[j] < hazards[i]: concord += 0.5
should be change to elif hazards[j] == hazards[i]: concord += 0.5
. Right ?
def CIndex(hazards, labels, survtime_all):
concord = 0.
total = 0.
N_test = labels.shape[0]
for i in range(N_test):
if labels[i] == 1:
for j in range(N_test):
if survtime_all[j] > survtime_all[i]:
total += 1
if hazards[j] < hazards[i]: concord += 1
elif hazards[j] < hazards[i]: concord += 0.5
return(concord/total)
Richarizardd commented
Hi @chengjianhong - to clarify, we are using the CIndex_lifeline
function from lifelines
to compute the c-Index.