Comments (3)
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.
Also what happens if I think of changing the classes to binary intstead of multiclass?
from lrp_for_lstm.
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_input
methods, 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)
- A question about single LSTM HOT 1
- Stacked/multilayer LSTM with Attention
- regression
- Using LRP for clickstream data
- Architecture differences: Keras LSTM architecture to LSTM_bidi.py
- Relevance sensitive sentence representations
- will it work on windows computer? HOT 1
- error for run for first line HOT 1
- no colores for heatmap in web based demo as shown in paper HOT 1
- Enhancement: work for 2 classes HOT 1
- Can you please define the train() function for LSTM_bidi class? HOT 1
- How to propropagate individual hidden layer relevance scores of attention through LSTM? HOT 1
- Trained LSTM model adaptation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lrp_for_lstm.