GithubHelp home page GithubHelp logo

Comments (3)

ArrasL avatar ArrasL commented on June 16, 2024

Hi,

Yes you can train the bi-LSTM model with whatever neural network toolbox you like (Tensorflow, Pytorch, Keras, Dynet...).

Then you just need to save the trained model's weights as numpy arrays to use the LRP code (and check the ordering of the gates in your weights to make them compatible with the LRP code, here are some hints how to do this).

from lrp_for_lstm.

akshayuppal3 avatar akshayuppal3 commented on June 16, 2024

Also what happens if I think of changing the classes to binary intstead of multiclass?

from lrp_for_lstm.

ArrasL avatar ArrasL commented on June 16, 2024

Binary classification is just a special case of multiclass classification. So there is nothing you need to care about or change in the code if you want to apply it to a binary prediction task (the number of classes is not hard coded).

Just save your weights in a python dict of numpy arrays (akin model in the __init__ method of the class LSTM_bidi). The input, hidden layer and output dimensions will then be inferred from the weights' shapes.

Typically, the only places where you need to adapt the code, will be the __init__ and set_inputmethods, where you load your trained model, and define the input sequence x (x_rev).
The other methods don't need to be changed, if your model is a standard LSTM.

from lrp_for_lstm.

Related Issues (14)

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.