Comments (8)
@FilipJanitor are you interested in evaluating the network on a sequence step by step?
from keract.
Also activations = outputs by the way here.
from keract.
If you're interested in that, the most straightforward I see is just to split your sequence and feed the cum seq (cf below) to the network:
Your sequence: abcdefg
feed: a -> get activations (outputs of a)
feed: ab -> get activations (outputs of ab)
feed: abc -> get activations (outputs of abc)
...
feed: abcdefg.
I'm sure there are better ways to handle that but it's pretty hacky and straightforward.
from keract.
I know for sure that obtaining the next character of the sequence using the model.predict(input)
and picking the character using the output probabilities works as expected. I am not sure about the approach you suggested as I don't know how would such iterative feeding affect the internal state of the RNN.
But what you said about the activations and outputs sounds very promising. Assuming that predict
returns the outputs of last layer I should be able to reconstruct the output of the last layer from what is returned by get_activations
right? The only thing that is a bit confusing for me is this line: https://github.com/philipperemy/keras-activations/blob/e665695e10bf80d77e0bad21319227fb021007f9/keract/keract.py#L30 what would it get in relation to activations if it was uncommented?
Thanks!
from keract.
This func
is a Keras function where you define an input tensor and an output tensor. By feeding the input tensor with a numpy matrix, you evaluate the value of the output tensor.
In that case, we list all the layers and we evaluate them one by one. So for your input, you get the output of every layer with this package.
Predict does the same but on the whole model. It will output the outputs of the final layer.
layer_outputs = activations.
Sorry for the confusion ;)
from keract.
LSTM has two components when you evaluate a sequence: States and Outputs. We're only talking about outputs here.
from keract.
Yeah, sorry - I made it more complex than it is. It is all clear now :)
Thanks, for help!
from keract.
Ok happy I could help :)
from keract.
Related Issues (20)
- Plans to enable eager execution from TF 2.0? HOT 10
- Error when using model.add_loss HOT 5
- Regression CNN HOT 19
- Visualization on image sequence HOT 2
- Layer Import HOT 1
- Keras symbolic input/outputs and layer_names issue HOT 8
- Using an input other than the one provided by the pre-trained model fails. HOT 20
- get_activations: AttributeError when nested=True HOT 6
- Any plans for Pytorch implementation? HOT 2
- Heatmaps - ValueError: X has 20 features, but MinMaxScaler is expecting 1 features as input. HOT 17
- Can not convert a odict_values into a Tensor or Operation HOT 1
- custom loss not working any more
- Example in the README: 'Functional' object has no attribute '_layers' HOT 2
- display_heatmaps() ValueError: X has 28 features, but MinMaxScaler is expecting 1 features as input. HOT 2
- Interaction with submodels? HOT 5
- Trying to use keract.get_activations() for days, keep getting stuck HOT 3
- Implement with GradientTape
- Help with get_activations HOT 4
- display_heatmap error
- Scikit-learn requirement HOT 7
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 keract.