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

478 rise for time series #506

Merged
merged 24 commits into from
Mar 30, 2023
Merged

478 rise for time series #506

merged 24 commits into from
Mar 30, 2023

Conversation

cwmeijer
Copy link
Contributor

@cwmeijer cwmeijer commented Mar 9, 2023

Add RISE for timeseries.

@cwmeijer
Copy link
Contributor Author

cwmeijer commented Mar 9, 2023

I added RISE and 2 tests for it. I didn't test it with actual data or with an actual model. There is also something not right with the output format. It is inconsistent with the timeseries visualization. RISE is now returning a saliency map as an np array while the visualization is expecting a dict with starts and stops and weights. Therefore, the test_common_usage.py contains some transformation code.

@geek-yang, maybe you would like to have a look what should be a good general format for timeseries saliency. I suppose the dict option is not bad and quite general, but it contains an 'index' key which I don't understand why that's useful. Also, maybe creating a dataclass for this is better than dicts.

@geek-yang
Copy link
Member

I added RISE and 2 tests for it. I didn't test it with actual data or with an actual model. There is also something not right with the output format. It is inconsistent with the timeseries visualization. RISE is now returning a saliency map as an np array while the visualization is expecting a dict with starts and stops and weights. Therefore, the test_common_usage.py contains some transformation code.

@geek-yang, maybe you would like to have a look what should be a good general format for timeseries saliency. I suppose the dict option is not bad and quite general, but it contains an 'index' key which I don't understand why that's useful. Also, maybe creating a dataclass for this is better than dicts.

I looked into the implementation (also with dummy data given in the test, not real model) and it worked well. The output shape of saliency map is exactly the same as the one from rise explainer for image, which is [label2explain, signal length, number of variables] in our case. I prefer to keep it consistent among all RISE approaches. I think we can add a transformation function, just like what you did.

On the other hand, the current implementation of visualization #491 doesn't seem to be compatible with multivariate timeseries. We need to update it as well later. I think for now we can test the implementation with weather dataset, to see if we could get something plausible (well... given our native segmentation strategy...or let's say...in this case no segmentation strategy, the results could be very bad...But at least we have a starting point for the implementation of skillful strategies).

@geek-yang geek-yang self-requested a review March 14, 2023 10:51
@geek-yang geek-yang linked an issue Mar 20, 2023 that may be closed by this pull request
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@cwmeijer cwmeijer marked this pull request as ready for review March 28, 2023 09:43
Copy link
Member

@geek-yang geek-yang left a comment

Choose a reason for hiding this comment

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

Awesome work! I really like the idea about having the hot and cold day dummy data to test if the method works as expected or not. This solves our big puzzle and it can be applied to test other methods as well. Well done!

dianna/__init__.py Outdated Show resolved Hide resolved
dianna/__init__.py Outdated Show resolved Hide resolved
dianna/methods/rise.py Show resolved Hide resolved
dianna/utils/maskers.py Outdated Show resolved Hide resolved
tests/test_common_usage.py Outdated Show resolved Hide resolved
tests/test_common_usage.py Outdated Show resolved Hide resolved
tests/test_common_usage.py Outdated Show resolved Hide resolved
tests/methods/time_series_test_case.py Outdated Show resolved Hide resolved
cwmeijer and others added 2 commits March 30, 2023 16:17
Co-authored-by: Yang <y.liu@esciencecenter.nl>
@geek-yang
Copy link
Member

Follow our discussion, I have created a new task on the board related to the notebook #539 . I will polish the notebook and add an ONNX example there.

@geek-yang geek-yang merged commit 7987e51 into main Mar 30, 2023
@geek-yang geek-yang deleted the 478-rise-for-time-series branch March 30, 2023 15:51
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.

Implement RISE functionality
2 participants