Keras CheatSheet PGAA
Keras CheatSheet PGAA
Here is an overview of the basic 1.Sequence padding CNN is a deep learning network
model architecture you can build Used to ensure all sequences in the list have
the same length used for image classification.
using Keras.
Recurrent Neural Network Model compilation and training Model evaluation and prediction.
This is a type of deep neural network Compilation Evaluation
where the output from the previous After building the model it is required to To evaluate the performance of the
step is fed as input to the present step. compile the model model after training.
model.compile(optimizer='rmsprop', score = model.evaluate(x_test,
Code: loss='mse', metrics=['accuracy']) y_test,batch_size=32)
from keras.layers import The optimizers supported are
Embedding,LSTM Sgd,adam,adagrad,rmsprop,adaboost. Prediction
model.add(Embedding(200,128)) Losses supported are After evaluating the model accuracy, to
model.add(LSTM(64,dropout=0.2,rec mse,rmse,binary_crossentropy and predict the output on unseen data
urrent_dropout=0.2)) categorical_crossentropy. model.predict(x_test, batch_size=32)
model.add(Dense(10,activation='sigm
oid')) Training
To train the model:
model.fit(x_train, y_train,batch_size=32,
epochs=15,
verbose=1,validation_data=(x_test,y_test))