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

add time series tutorial #177

Merged
merged 9 commits into from
Oct 20, 2022
Merged

add time series tutorial #177

merged 9 commits into from
Oct 20, 2022

Conversation

dkrako
Copy link
Collaborator

@dkrako dkrako commented Oct 20, 2022

Description

Implemented changes

  • added tutorial notebook

Minimum acceptance criteria

  • I don't know

@annahedstroem unfortunately I currently cannot install the quantus package anymore on my system (python 3.10).
I'm somehow getting dependency issues which cannot be resolved, and even when I ignore this, the numpy versions just don't match? I'm very confused why this happens.

@codecov-commenter
Copy link

codecov-commenter commented Oct 20, 2022

Codecov Report

Merging #177 (16bb2a0) into main (351f264) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #177   +/-   ##
=======================================
  Coverage   92.86%   92.86%           
=======================================
  Files          54       54           
  Lines        2649     2649           
=======================================
  Hits         2460     2460           
  Misses        189      189           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@annahedstroem annahedstroem left a comment

Choose a reason for hiding this comment

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

@dkrako made some smaller updates to the file. but it throws an error:

--------------------------------------------------------------------------

ValueError                                Traceback (most recent call last)

/var/folders/w2/h9z278fs179f393h2jbj3y_80000gn/T/ipykernel_50650/2093353479.py in <module>
      1 # Return ModelParameterRandomisation scores for Integrated Gradients.
----> 2 scores_intgrad = metric_init(
      3     model=net,
      4     x_batch=test_features,
      5     y_batch=test_labels,

~/anaconda3/envs/quantus/lib/python3.9/site-packages/quantus/metrics/randomisation/model_parameter_randomisation.py in __call__(self, model, x_batch, y_batch, a_batch, s_batch, custom_batch, channel_first, explain_func, explain_func_kwargs, model_predict_kwargs, softmax, device, **kwargs)
    146             custom_batch,
    147             custom_preprocess_batch,
--> 148         ) = self.general_preprocess(
    149             model=model,
    150             x_batch=x_batch,

~/anaconda3/envs/quantus/lib/python3.9/site-packages/quantus/metrics/base.py in general_preprocess(self, model, x_batch, y_batch, a_batch, s_batch, custom_batch, channel_first, explain_func, explain_func_kwargs, model_predict_kwargs, softmax, device)
    298         # Reshape input batch to channel first order:
    299         if not isinstance(channel_first, bool):  # None is not a boolean instance.
--> 300             channel_first = utils.infer_channel_first(x_batch)
    301         x_batch = utils.make_channel_first(x_batch, channel_first)
    302 

~/anaconda3/envs/quantus/lib/python3.9/site-packages/quantus/helpers/utils.py in infer_channel_first(x)
    178 
    179     else:
--> 180         raise ValueError(
    181             "Only batched 1d and 2d multi-channel input dimensions supported."
    182         )

ValueError: Only batched 1d and 2d multi-channel input dimensions supported.

when trying to evaluate. the size of the test_features are (1000, 40)

@annahedstroem
Copy link
Member

Fixed the error by removing the reduce_axes argument and reshaping the features as follows:

test_features = test_features.reshape(1000, 1, 40)

@annahedstroem annahedstroem merged commit 29586b4 into main Oct 20, 2022
@annahedstroem annahedstroem deleted the feature/time_series_tutorial branch January 11, 2023 08:24
aaarrti pushed a commit that referenced this pull request Apr 9, 2023
…feature/time_series_tutorial

add time series tutorial
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.

3 participants