-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimu_2_compute_error.py
34 lines (28 loc) · 1.06 KB
/
simu_2_compute_error.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
This module compares the predicted cause-specific hazards to the ground truth.
It also converts the cause-specific hazards into incidence functions.
The mean absolute errors are computed and saved as csv files.
The error for each prediction are saved under a single dictionary for the
cause-specific hazard (haz), the cumulated incidence function (cif) and the
incidence function (if).
modelnames (list[str]) : the list of models
n_patients (list[int]) : the number of patients in each simulation that needs to
be evaluated.
"""
from utils.error_computation import ErrorComputation
if __name__ == '__main__':
n_patients = [
2_000,
5_000,
10_000,
20_000,
50_000,
100_000
]
for n in n_patients:
ec = ErrorComputation(dirname='rundir',
n_patients=n,
event_labels={1: '1', 2: '2', 3: '3'},
gt_is_known=True)
ec.run()
print(n, '\n', ec.err.xs('haz', level='function').groupby(level='model').mean())