Metrics API
survfm.metrics.ipcw_rmst_rmse(train_time, train_event, test_time, test_event, predicted_rmst, tau, *, support_threshold=1e-06)
Compute test-set-denominator IPCW restricted-time prediction error.
The observable restricted outcome is min(T, tau). It is known when an
event occurs on or before tau or when observed follow-up reaches
tau. Censored-before-horizon rows contribute zero to the Horvitz-
Thompson numerator but remain in the full test-set denominator. Event rows
use G(Y-) and horizon-reaching rows use G(tau), where G is the
training-fold Kaplan-Meier estimate of censoring survival.
A block is returned as non-evaluable (rmse and normalized_rmse are
NaN) if any otherwise observable row has an unsupported censoring weight or
nonfinite prediction. Weights are never silently floored or truncated.
Source code in survfm/metrics.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
survfm.metrics.uno_c_from_predicted_rmst(train_time, train_event, test_time, test_event, predicted_rmst)
Compute Uno's C from predicted RMST using scikit-survival.
The dependency is imported lazily so the lightweight package remains importable in environments without scikit-survival.
Source code in survfm/metrics.py
survfm.metrics.predicted_rmst_to_risk(predicted_rmst)
Orient predicted RMST for concordance metrics.
Larger RMST means longer predicted event-free time, so risk is -RMST.
survfm.metrics.rmse(y_true, y_pred)
survfm.metrics.normalized_rmse(y_true, y_pred, tau)
RMSE divided by the restriction horizon tau.