Coder Social home page Coder Social logo

Comments (8)

philipperemy avatar philipperemy commented on June 8, 2024

@FilipJanitor are you interested in evaluating the network on a sequence step by step?

from keract.

philipperemy avatar philipperemy commented on June 8, 2024

Also activations = outputs by the way here.

from keract.

philipperemy avatar philipperemy commented on June 8, 2024

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.

FilipJanitor avatar FilipJanitor commented on June 8, 2024

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.

philipperemy avatar philipperemy commented on June 8, 2024

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.

philipperemy avatar philipperemy commented on June 8, 2024

LSTM has two components when you evaluate a sequence: States and Outputs. We're only talking about outputs here.

from keract.

FilipJanitor avatar FilipJanitor commented on June 8, 2024

Yeah, sorry - I made it more complex than it is. It is all clear now :)
Thanks, for help!

from keract.

philipperemy avatar philipperemy commented on June 8, 2024

Ok happy I could help :)

from keract.

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.