Git Product home page Git Product logo

Comments (2)

AvantiShri avatar AvantiShri commented on May 21, 2024

Hi younglululu,

I had to refresh my memory, but the answer is yes! find_scores_layer_idx (for a sequential model) and find_scores_layer_name (for a graph model) can actually be lists:

https://github.com/kundajelab/deeplift/blob/master/deeplift/models.py#L225-L227
https://github.com/kundajelab/deeplift/blob/master/deeplift/models.py#L278-L280

I would have changed the names of the arguments to reflect this, but I didn't want to break the API. Let me know if you have any issues.

from deeplift.

AvantiShri avatar AvantiShri commented on May 21, 2024

Oh, one more followup remark: for all layers except the input layer, multipliers are split up into pos_mxts and neg_mxts (as needed by the RevealCancel rule described in the DeepLIFT paper). For layers that act as inputs to nonlinearities, these will be different, but for layers that act as inputs to a linear layer, these should be the same. Because get_mxts() is not defined for anything other than Input layers (instead, there is get_pos_mxts() and get_neg_mxts()), you could modify the following line https://github.com/kundajelab/deeplift/blob/master/deeplift/models.py#L56 to use the average of get_pos_mxts() and get_neg_mxts() if get_mxts() is not defined for the layer. The code would look something like this:

output_symbolic_vars = [
             (find_scores_layer.get_mxts() if hasattr(find_scores_layer, 'get_mxts())
              else 0.5*(find_scores_layer.get_pos_mxts() + find_scores_layer.get_neg_mxts()))
             for find_scores_layer in find_scores_layers]

Let me know if that works for your purposes, and if it does, would be happy to accept a pull request to the main code base!

from deeplift.

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.