Code Monkey home page Code Monkey logo

Comments (4)

JoaoPBSousa avatar JoaoPBSousa commented on May 22, 2024 1

Hi @userbm ,

In TimeSHAP you can only obtain the event-wise shapley values through the method timeshap.explainer.event_level.event_level, but this method is currently wrapped by timeshap.explainer.event_level.local_event which is the one users are supposed to use.

Regarding the methods you mentioned:

  1. timeshap.explainer.pruning.local_pruning() is responsible for calculating the pruning algorithm values. Once this values are obtained, a pruning index can be calculated by applying the user-defined pruning tolerance.
  2. timeshap.explainer.kernel.TimeShapKernel.shap_values() is responsible for calculating all types of explanations, depending on the explanation mode you provide when creating the TimeShapKernel object.

If you only require standard explanations from TimeSHAP, I would recommend using the following methods: local_pruning, local_event, local_feat, local_cell_level, prune_all, event_explain_all, feat_explain_all. If you need to use other methods in the package, feel free to ask any questions you may have.

In response to your question about the pruning index, I would need more context to provide a specific answer. In TimeSHAP, the pruning index indicates that all older events (in respect to the index) are to be grouped as to not waste computational power on using them for coalitions and scoring. This index affects the calculated explanations as it as it changes the number of events that are perturbed to compute them.

I hope this answer is helpful. If you have any further questions feel free to ask.

from timeshap.

JoaoPBSousa avatar JoaoPBSousa commented on May 22, 2024

Hi @userbm ,

You can obtain the contributions for all types of explanations by using the methods to calculate them. They are showcased in our notebook AReM.ipynb. These are: local_pruning, local_event, local_feat, local_cell_level, prune_all, event_explain_all, feat_explain_all.

Additionally, if you pass the argument "path" in the explanation configuration dictionaries, you can have the contributions being saved on a csv on your local device.

If you have any further questions, don't hesitate to contact us

from timeshap.

userbm avatar userbm commented on May 22, 2024

Thank you @JoaoPBSousa for the reply. AReM.ipynb was very explanatory.
Going through the code, I find that event-wise shap values can be obtained through either of the following:
1. timeshap.explainer.pruning.local_pruning()
2. timeshap.explainer.kernel.TimeShapKernel.shap_values()
But the values I obtained are slightly different in these two cases. The difference might be because of the pruning index argument in the latter. But I don't understand why the shap values are different with or without pruning index.
Can you tell me why the difference? Or which one is correct, if I understood these incorrectly?

from timeshap.

userbm avatar userbm commented on May 22, 2024

Thank you @JoaoPBSousa for the detailed reply. This sufficiently answers my doubts.

from timeshap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.