Keras – simplifying deep learning

With the HPC Viper team, the senior RSE has been investigating the python API Keras which vastly simplifies the programming of deep learning computational graphs. Using a number of the free-available data sets including the mnist character sets. The outcomes have been very encouraging and allow the researcher to concentrate on the neural nets interconnections rather than the depth of programming and optimisation that other libraries demand.

A typical neural net can be constructed with 9 lines of code, as below:


model = Sequential()

model.add(Convolution2D(32, 3, 3, activation='relu', input_shape=(1,28,28)))
model.add(Convolution2D(32, 3, 3, activation='relu'))
model.add(MaxPooling2D(pool_size=(2,2)))
model.add(Dropout(0.25))

model.add(Flatten())
model.add(Dense(128, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(10, activation='softmax'))

Leave a Reply

Your email address will not be published. Required fields are marked *