Notes about Keras deeplearning framework

Posted on Mon 27 June 2016 in Notes

Short introduction to Keras

Keras can be thought of as 4 steps

  • Prepare input and output tensors
  • Create first layer (input)
  • Create output layer
  • Build any model inbetween

Everything is a layer!

Layers are minimally defined as output dimensions (input dimensions are optional, typically only required for first layer)

return_sequence, if true output can be feeded to another RNN

map to a sequence

if false, feed to fully connected layers

even dropout is a layer. Makes sense, as dropout can be seen as a

random matrix that will multiply inputs with 1 or 0


instantiate a model:

model = Sequential()

Expand a model

 model.add([layer type])

Check a model


Neural Net is implemented as a model

  • Layers are all contained within a model

Sequential model

  • Regular run-of-the-mill NN
  • setup input and output layer
  • one layer feeds into the next


  • One layer can split into several layers

model.Compile() sets up your model, which loss-function and optimizer that will be used. This will compile the model into machine code via Theano or TensorFlow. is the training function.