Git Product home page Git Product logo

Comments (10)

AvantiShri avatar AvantiShri commented on May 18, 2024

Hi @KeLanhhh,

Thanks for reaching out. Is it not possible to achieve global maxpooling by specifying a pooling width that covers your entire input?

To make DeepLIFT support your customized layer, you would need to define a DeepLIFT layer object that corresponds to your layer, and then define a conversion function. I can explain how to do these things, but it may be better to wait until after a DeepLIFT update I am planning to put out in the next week or so (the update will be accompanied by a new ArXiv preprint). Would it be possible to wait that long? If not, let me know and I can guide you on how to achieve your desired layer in the current implementation (assuming that a pooling layer with a sufficiently large pooling width does not satisfy your use-case)

from deeplift.

KeLanhhh avatar KeLanhhh commented on May 18, 2024

Thank you for the quick reply! @AvantiShri, a week or longer would be okay for me, just do you work first. By the way, my input length is not too long, So selecting top k max features might perform better than usual local max pooling.
ps: looking forward to your big update!

from deeplift.

ttgump avatar ttgump commented on May 18, 2024

Does DeepLIFT support to use deep residual? I have a model with deep residual, and want to use DeepLIFT to interpret it too. Thanks!

from deeplift.

AvantiShri avatar AvantiShri commented on May 18, 2024

Hi @ttgump - not yet, but it would not be hard to add. Can you tell me more about the layer types you use to implement the resnet (are you using Keras?)

from deeplift.

ttgump avatar ttgump commented on May 18, 2024

@AvantiShri Yes, I am using Keras.

from deeplift.

AvantiShri avatar AvantiShri commented on May 18, 2024

@ttgump Great, if I understand correctly you are probably using a merge layer with "sum" as the merge mode. Currently I have support for the "concat" merge mode but I can add "sum". Just to be on the safe side, can you let me know any other layer types you might be using?

from deeplift.

KeLanhhh avatar KeLanhhh commented on May 18, 2024

Hi, @AvantiShri

I read your new preprint of DeepLift, nice job! I think the separated positive and negative contribution might be very useful to my work.

Like what we discussed before, I want to apply DeepLift to my model which contains a customized k max pooling layer. At your convenience, could you teach me how to achieve my desired layer in the current DeepLift implementation? If need, I can also post the code of my layer here.

Thank you :)

from deeplift.

AvantiShri avatar AvantiShri commented on May 18, 2024

@KeLanhhh Glad you liked the paper! Yes, it would be helpful if you tell me about the implementation of your layer here, and then I can advise you on how to adapt it for DeepLIFT.

from deeplift.

KeLanhhh avatar KeLanhhh commented on May 18, 2024

@AvantiShri Here is code of k max pooling layer used in my model.

from keras import backend as K
from keras.engine.topology import Layer

class KMaxPooling(Layer):
    
    def __init__(self, K, **kwargs):
        super(KMaxPooling, self).__init__(**kwargs)
        self.K = K
    
    def get_output_shape_for(self,input_shape):
        shape = list(input_shape)
        shape[1] = self.K
        return tuple(shape)

    def call(self,x,mask = None):
        k = theano.tensor.cast(self.K, dtype="int32")
        sorted = theano.tensor.sort(x, axis = 1)
        out = sorted[:, -k:, :]
        return out

    def get_config(self):
        config = {"pool_size": self.K}
        base_config = super(KMaxPooling, self).get_config()
        return dict(list(base_config.items()) + list(config.items()))

Is it hard to convert? Please let me know if you need any further information!
Thanks!

from deeplift.

nicofarr avatar nicofarr commented on May 18, 2024

Hi there,

I also have a customized layer implemented in Keras (code is here). It may be slightly more complicated than @KeLanhhh 's case though as it is a trainable layer. Could you help in supporting this in DeepLift ?

Thanks a lot in advance,

Best

Nicolas

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.