Git Product home page Git Product logo

Comments (4)

AvantiShri avatar AvantiShri commented on May 17, 2024

Hi Christopher,

You’re fine, the issue is with deeplift.

(1) get_name_to_blob is indeed deprecated to get_name_to_layer. Where did you encounter get_name_to_blob? I thought I had updated the README, evidently i missed something somewhere.

(2) Some context about the second error you are getting: traditionally, people use sigmoid or softmax outputs when doing classification, and linear outputs when doing regression. In the case of the former, DeepLIFT computes the contribution wrt the linear activation preceeding the final nonlinearity to avoid the saturation effects of the sigmoid/softmax. In the case of a linear output, DeepLIFT computes contributions wrt to the provided linear layer. You are trying to compute contributions to a linear layer that is followed by a ReLU nonlinearity. I can add this case in (would need to clarify how you want to handle ReLU saturation), but I also note that you are evidently computing contributions to neurons in the first convolutional layer. Is that actually the layer you are interested in? And do you care about interpeting individual neurons in the conv layer, or the activation of the entire layer as a whole? If you care about interpreting every individual neuron in the conv layer, you might find it easier to compute the contributions using a series of numpy matrix multiplications (which is tractable to implement for just a single layer; I can describe how to do this if that is in fact what you are after). DeepLIFT is currently set up to compute contributions to one target output neuron at a time, so it would be cumbersome to perform DeepLIFT for every individual neuron in the conv layer.

from deeplift.

cap76 avatar cap76 commented on May 17, 2024

Hi Avanti,

Thanks for the quick response. I think I came across get_name_to_blob scrolling through the issues thread.

  1. You're right, the code I pasted was wrong (I'd been playing around with it a little), and I do not really want the contribution to layers in the first convolutional layer. I think the correct call would be:

revealcancel_func = deeplift_model.get_target_contribs_func(find_scores_layer_name="input_1_0", pre_activation_target_layer_name="preact_dense_3_0")

This seems to throw a different error:

File "", line 1, in
File "/Users/christopher_penfold/Desktop/Code/deeplift/deeplift/models.py", line 113, in get_target_contribs_func
return self._get_func(*args, func_type=FuncType.contribs, **kwargs)
File "/Users/christopher_penfold/Desktop/Code/deeplift/deeplift/models.py", line 269, in _get_func
**kwargs)
File "/Users/christopher_penfold/Desktop/Code/deeplift/deeplift/models.py", line 49, in _get_func
find_scores_layer.update_mxts()
File "/Users/christopher_penfold/Desktop/Code/deeplift/deeplift/layers/core.py", line 183, in update_mxts
output_layer.update_mxts()
File "/Users/christopher_penfold/Desktop/Code/deeplift/deeplift/layers/core.py", line 183, in update_mxts
output_layer.update_mxts()
File "/Users/christopher_penfold/Desktop/Code/deeplift/deeplift/layers/core.py", line 184, in update_mxts
output_layer._update_mxts_for_inputs()
File "/Users/christopher_penfold/Desktop/Code/deeplift/deeplift/layers/core.py", line 346, in _update_mxts_for_inputs
neg_mxts_increments) = self._get_mxts_increments_for_inputs()
File "/Users/christopher_penfold/Desktop/Code/deeplift/deeplift/layers/pooling.py", line 89, in _get_mxts_increments_for_inputs
pos_mxts_increments = self._grad_op(self.get_pos_mxts())
File "/Users/christopher_penfold/Desktop/Code/deeplift/deeplift/layers/pooling.py", line 79, in _grad_op
return tf.squeeze(nn_grad.gen_nn_ops.max_pool_grad(
AttributeError: module 'tensorflow.python.ops.gen_nn_ops' has no attribute 'max_pool_grad'

For my setup I'm doing classification (potentially multi class multi output classification) I was using the RelU layers just based on some code I had. Should be easy enough to switch to sigmoid or softmax if these would be more appropriate and don't expect the accuracy to be

from deeplift.

AvantiShri avatar AvantiShri commented on May 17, 2024

Yes, I think sigmoid/softmax outputs are def more appropriate for classification if trained with binary/categorical crossentropy losses.

I think the error you got is caused by using an old version of tensorflow. Can you upgrade to tensorflow version 1.7 or later?

from deeplift.

cap76 avatar cap76 commented on May 17, 2024

Ah! Of course facepalm 😳Seems to work now, will continue going through, but I think we can call this issue closed

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.