[PyHealth2.0 Bounty] MIMIC3 Readmission Prediction #751
+407
−132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR updates the
readmission_prediction_mimic3_fnfor PyHealth 2.0. I'll complete the readmission prediction tasks for the other datasets once this PR merges. This early PR should make that next PR go more smoothly.In addition to supporting PyHealth 2.0, the new
ReadmissionPredictionMIMIC3task has the following improvements. First, it takes adatetime.timedeltainstead of anintfor the readmission window, making the input parameter clearer and more flexible. Second, it can optionally exclude visits where the patient was under 18 years old (a previously unimplemented#todo).Besides the items listed above,
ReadmissionPredictionMIMIC3should be logically equivalent toreadmission_prediction_mimic3_fn.Testing
I added unit tests for
ReadmissionPredictionMIMIC3and updated and ranexamples/readmission_mimic3_rnn.py.I also updated
examples/readmission_mimic3_fairness.py, but it doesn't run asfairness_metrics_fnwas disabled in #320.Additional Notes
Apologies for all the whitespace changes in
README.rst. My editor automatically removes trailing whitespace and I had to update a code snippet in that file. Let me know if you'd rather not merge the whitespace changes and I can undo them.I'm curious what you think of the new
MockMICIC3Datasetclass I created for the unit tests. Would that be helpful elsewhere to keep the unit test run times short (instead of using the demo datasets)?I considered keeping
readmission_prediction_mimic3_fnas a wrapper aroundReadmissionPredictionMIMIC3for backwards compatibility (I saw #735 does this for the LoS tasks). However, I'm not sure the changes to the LoS tasks are actually backwards compatible. The new tasks return lists for conditions, procedures, and drugs. The old tasks used to return lists of lists for these items but now as pass throughs they just return lists. I'm not sure if that change in behavior would impact users of the old tasks.