splits¶
topic_segmentation.data.mimic.splits
Create nested, patient-disjoint MIMIC training and validation sets.
python -m topic_segmentation.data.mimic.splits POOL --train-sizes 50 100 300 1000 4000 --prefix-sizes 8 16 32
python -m topic_segmentation.data.mimic.splits LARGE_POOL --extends POOL --train-sizes 10000 30000 100000
Read note caches and segmentation_labels/ from POOL; write to POOL/splits_valid1000_seed42. Reserve 1,000 notes for validation and keep patients separate across train, validation, and test. --prefix-sizes selects whole-patient prefixes of the smallest training set. --extends retains the earlier pool's validation set and largest training subset.
read_ids(path)
¶
Source code in src/topic_segmentation/data/mimic/splits.py
25 26 | |
note_ids(patients, notes_of)
¶
Source code in src/topic_segmentation/data/mimic/splits.py
29 30 | |
take_patients(candidates, notes_of, size)
¶
Select whole patients in order to reach size notes, skipping groups that would exceed it.
Source code in src/topic_segmentation/data/mimic/splits.py
33 34 35 36 37 38 39 40 41 42 43 44 | |
whole_patients(ids, subject, notes_of)
¶
Return patient IDs, checking that ids contains each patient's full set of notes.
Source code in src/topic_segmentation/data/mimic/splits.py
47 48 49 50 51 52 | |
patient_prefix(ids, size, subject)
¶
Select the first size notes grouped by patient, requiring a whole-patient prefix.
Source code in src/topic_segmentation/data/mimic/splits.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
write_split(directory, name, ids, rows)
¶
Write ids/<name>.txt and <level>/<name>.jsonl; return the split statistics.
Source code in src/topic_segmentation/data/mimic/splits.py
71 72 73 74 75 76 77 78 79 80 81 82 | |
main()
¶
Source code in src/topic_segmentation/data/mimic/splits.py
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 | |