A feed-forward neural network using Keras
Keras is a DL library, originally built on Python, that runs over TensorFlow or Theano. It was developed to make DL implementations faster:
- We call
install kerasusing the following command in your operation system's Command Prompt:
pip install keras- We start by importing the
numpyandpandaslibrary for data manipulation. Also, we set aseedthat allows us to reproduce the script's results:
import numpy as np import pandas as pd numpy.random.seed(8)
- Next, the sequential model and dense layers are imported from
keras.modelsandkeras.layersrespectively. Keras models are defined as a sequence of layers. The sequential construct allows the user to configure and add layers. The dense layer allows a user to build a fully connected network:
from keras.models import Sequential from keras.layers import Dense
- The
HRattrition dataset is then loaded, which has 14,999 rows and 10 columns. Thesalaryandsalesattributes are one-hot encoded to be used by Keras for...