Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in PyPOTS_Imputation.ipynb #19

Closed
dbuscombe-usgs opened this issue Jan 18, 2025 · 3 comments
Closed

Error in PyPOTS_Imputation.ipynb #19

dbuscombe-usgs opened this issue Jan 18, 2025 · 3 comments

Comments

@dbuscombe-usgs
Copy link

the following code returns an error

testing_mae = calc_mae(
    saits_imputation, 
    physionet2012_dataset['test_X_ori'], 
    physionet2012_dataset['test_X_indicating_mask'],
)

test_X_indicating_mask is not a key in the physionet2012_dataset dictionary. The following keys are available:

dict_keys(['n_classes', 'n_steps', 'n_features', 'scaler', 'train_X', 'train_y', 'train_ICUType', 'val_X', 'val_y', 'val_ICUType', 'test_X', 'test_y', 'test_ICUType', 'val_X_ori', 'test_X_ori'])

How might I create the variable test_X_indicating_mask. Thanks

@WenjieDu
Copy link
Owner

Hi there 👋,

Thank you so much for your attention to PyPOTS and BrewPOTS! You can follow me on GitHub to receive the latest news of PyPOTS. If you find PyPOTS and BrewPOTS helpful to your work, please star our repositories. Your star is your recognition, which can help more people notice PyPOTS and grow PyPOTS community. It matters and is definitely a kind of contribution to the community.

I have received your message and will respond ASAP. Thank you for your patience! 😃

Best,
Wenjie

@dbuscombe-usgs
Copy link
Author

I was able to create the mask by study other examples

indicating_mask = np.isnan(physionet2012_dataset['test_X']) ^ np.isnan(physionet2012_dataset['test_X'])  # indicating mask for imputation error calculation

# calculate mean absolute error on the ground truth (artificially-missing values)
testing_mae = calc_mae(
    saits_imputation, 
    physionet2012_dataset['test_X_ori'], 
    indicating_mask,
)
print(f"Testing mean absolute error: {testing_mae:.4f}")

However, now I get a new error

AssertionError: `targets` mustn't contain NaN values, but detected NaN in it

@dbuscombe-usgs
Copy link
Author

I believe this is fixed using the np.nan_to_num function for the data with the NaNs. Thank you very much for these tutorials, I have been able to mimic this workflow for my own data

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

No branches or pull requests

2 participants