December 2018
Intermediate to advanced
764 pages
18h 18m
English
Now let's build the same MLP network with Keras, a high-level library for TensorFlow. We keep all the parameters the same as we used for the TensorFlow example in this chapter, for example, the activation function for the hidden layers is kept as the ReLU function.
import kerasfrom keras.models import Sequentialfrom keras.layers import Densefrom keras.optimizers import SGD
num_layers = 2num_neurons = []for i in range(num_layers): num_neurons.append(256)learning_rate = 0.01n_epochs = 50batch_size = 100
Read now
Unlock full access