som-shahlab / ehr_ml

Code for doing machine learning with various EHRs
MIT License
21 stars 3 forks source link

[FIX] bug when using --exclude_patient_ratio #25

Closed marshuang80 closed 2 years ago

marshuang80 commented 2 years ago

When running create_clmbr_info with the --exclude_patient_ratio parameter, I got the following error message:

TypeError: unhashable type: 'list' on line 168

This is because result["train_patient_ids_with_length"] is a list of tuples (patient_ids, length).

Taking the first element of each tuple in the list fixes the error:

[x[0] for x in result["train_patient_ids_with_length"]]

EthanSteinberg commented 2 years ago

Thanks for fixing this! Didn't notice because I usually use a manual patient list (as it's a bit more reliable).