mp2893/gram

error running gram.py

Opened this issue · 4 comments

Hello,

I followed all the previous steps, but when I ran gram.py I get the following error

Traceback (most recent call last):
File "gram.py", line 406, in
numAncestors = get_rootCode(args.tree_file+'.level2.pk') - inputDimSize + 1
File "gram.py", line 397, in get_rootCode
rootCode = tree.values()[0][1]
IndexError: list index out of range

Do you have any idea why it's showing that? Any help would be really appreciated.

Thanks.

Is there a tensorflow implementation?

Hi jingjojo,

Sorry I missed your question for a quite a while. I think I never noticed an issue was raised.
Unfortunately, I don't have access to MIMIC3 right now, so it'd be quite difficult for me to test the codes. Do you still have this problem?

Best,
Ed

Hi WrathofBhuvan11,

No, currently this is the only implementation of GRAM.
There is no immediate plan to write a TensorFlow version for now.

Thanks,
Ed

Hey @jingjojo and @mp2893

I saw the issue and dug into it. I could actually reproduce it, and here is how to resolve it.

In the end, I figured out that this error of running gram.py actually comes from choosing the wrong input data in the process_mimic.py file, which will then produce faulty input files for the subsequent steps. Essentially, this causes the level2.pk file to be emtpy, which causes gram.py to fail as it opens the file but it is actually empty, and therefore the calc in gram.py for numAncestors fails.

So just run process_mimic.py with the correct files, run the build_trees.py after that, and then gram.py should just run.

Best
Michael