Keras Model composed of a linear stack of layers

Keras Model composed of a linear stack of layers

keras_model_sequential(layers = NULL, name = NULL)

Arguments

layers

List of layers to add to the model

name

Name of model

Note

The first layer passed to a Sequential model should have a defined input shape. What that means is that it should have received an input_shape or batch_input_shape argument, or for some type of layers (recurrent, Dense...) an input_dim argument.

See also

Examples

# NOT RUN {

library(keras)

model <- keras_model_sequential()
model %>%
  layer_dense(units = 32, input_shape = c(784)) %>%
  layer_activation('relu') %>%
  layer_dense(units = 10) %>%
  layer_activation('softmax')

model %>% compile(
  optimizer = 'rmsprop',
  loss = 'categorical_crossentropy',
  metrics = c('accuracy')
)
# }