Keras as a High-Level API
In TensorFlow 1.0, there were several APIs, such as Estimator, Contrib, and layers. In TensorFlow 2.0, Keras is very tightly integrated with TensorFlow, and it provides a high-level API that is user-friendly, modular, composable, and easy to extend in order to build and train deep learning models. This also makes developing code for neural networks much easier. Let's see how it works.
Exercise 2.05: Binary Classification Using Keras
In this exercise, we will implement a very simple binary classifier with a single neuron using the Keras API. We will use the same data.csv
file that we used in Exercise 2.02, Perceptron as a Binary Classifier:
Note
The dataset can be downloaded from GitHub by accessing the following GitHub link: https://packt.live/2BVtxIf.
- Import the required libraries:
import tensorflow as tf import pandas as pd import matplotlib.pyplot as plt %matplotlib inline # Import Keras libraries from tensorflow.keras.models import...