huaxiuyao / Wild-Time

Benchmark for Natural Temporal Distribution Shift (NeurIPS 2022)
MIT License
61 stars 8 forks source link

MIMIC-IV Preprocessing Issues #9

Open Nyquixt opened 1 year ago

Nyquixt commented 1 year ago

I tried running the code on MIMIC-IV and the preprocessing code gave me the following error:

File "Wild-Time/wildtime/data/mimic.py", line 272, in preprocess_MIMIC
    temp_datasets[eachyear]['code'] = np.array(temp_datasets[eachyear]['code'])
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (76175, 2) + inhomogeneous part.

Could you double check this issue? Thanks in advance!

-K

ZinebAg commented 1 year ago

Hi, got the same issue. I changed "temp_datasets[eachyear]['code'] = np.array(temp_datasets[eachyear]['code'])" to "temp_datasets[eachyear]['code'] =np.asarray(temp_datasets[eachyear]['code'],dtype="object")" and it worked for me. Hope it helps :)

Nyquixt commented 1 year ago

Thanks. I actually figured out a simpler solution but forgot to update the issue. Downgrading numpy to v1.19.5 (just like in the requirements.txt file) solved the problem. 🥲

aangelopoulos commented 6 months ago

The suggestion by @ZinebAg to change the line to temp_datasets[eachyear]['code'] =np.asarray(temp_datasets[eachyear]['code'],dtype="object") worked for me as well.

Someone should open a PR!