Skip to content

Fix ´infer_feature_types´ for 3D EHRData with X=None#246

Merged
sueoglu merged 4 commits into
mainfrom
bug/issue-245
Jun 3, 2026
Merged

Fix ´infer_feature_types´ for 3D EHRData with X=None#246
sueoglu merged 4 commits into
mainfrom
bug/issue-245

Conversation

@sueoglu

@sueoglu sueoglu commented May 31, 2026

Copy link
Copy Markdown
Collaborator

infer_feature_types was crashing on 3D EHRData objects when edata.X is None and it didnt account for 3D layer when it was passed to the function. This also affected imputation functions decorated with _check_feature_types.

  1. X is None: when data is stored only in a layer (e.g. physionet2012 dataset where X is None and data lives in tem_data), the function falls through to X = edata.X (which is None) when layer not specified, causing AttributeError

With the new changes it falls back to the first available layer when X is None and it vertically stacks timepoints and reshapes to (n_obs * n_t, n_vars) before building the df when the passed array is 3D.

sueoglu added 2 commits May 31, 2026 15:05
…layer + the layer=None is hardcoded in _check_feature_types if X is None it goes through layers of the input ehrdata
…ack to preserve variables along the time axis
Comment thread src/ehrdata/_feature_types.py Outdated

@eroell eroell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@sueoglu sueoglu merged commit 3ebf171 into main Jun 3, 2026
15 of 19 checks passed
@sueoglu sueoglu deleted the bug/issue-245 branch June 3, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants