liveBook · Manning

Sequential model

As explained in Deep Learning with R, Third Edition

A sequential model is a Keras model that represents a simple linear stack of layers with one input and one output.

A Sequential model is a Keras model built as a simple linear stack of layers: one input flows through each layer to one output. It is the most approachable model-building API, but it is limited to straightforward stacks rather than branching or graph-like topologies. section 3.6.3 section 7.2

A two-layer Sequential model

library(keras3) model <- keras_model_sequential() |> layer_dense(64, activation = "relu") |> layer_dense(10, activation = "softmax") The same model can be assembled incrementally by appending layers. To inspect shapes while building, declare the input shape first: keras_model_sequential(input_shape = c(3)). section 7.2.1

Keep these construction and debugging details in mind:

  • Layers create their weights when first called, or when model$build(input_shape = ...) is used; an unbuilt model has no weights. section 7.2.1
  • Choose the Functional API for graph-shaped architectures and model subclassing when you need low-level control; these approaches can still interoperate with Sequential models. section 7.2 section 7.2.4

How Deep Learning with R, Third Edition covers it

How deep it goes
Explains construction, deferred weight creation, input shapes, summaries, naming, and API limits, but stops short of advanced graph architectures.
Examples
Uses chained Dense layers, incremental layer addition, explicit input shapes, model summaries, parameter counts, and named layers.
What it assumes
Assumes familiarity with Keras layers and tensors while teaching model construction and deferred weight creation through concrete examples.
What you can do after
Build it from scratch with keras_model_sequential(), inspect its structure, and diagnose shape or construction issues with build() and summaries.
How it connects
Connects Sequential models with Keras Model, layers, the Functional API, model subclassing, and network topology.

Also explained in

Compare how 2 books explain Sequential model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.