Working with the basic building blocks of the Keras API
Keras is the official high-level API for TensorFlow 2.x and its use is highly encouraged for both experimental and production-ready code. Therefore, in this first recipe, we'll review the basic building blocks of Keras by creating a very simple fully connected neural network.
Are you ready? Let's begin!
Getting ready
At the most basic level, a working installation of TensorFlow 2.x is all you need.
How to do it…
In the following sections, we'll go over the sequence of steps required to complete this recipe. Let's get started:
- Import the required libraries from the Keras API:
from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelBinarizer from tensorflow.keras import Input from tensorflow.keras.datasets import mnist from tensorflow.keras.layers import Dense from tensorflow.keras.models import Model from tensorflow.keras.models import Sequential...