Example #1
"""Get functions"""
print("complie: _train")
_train = K.function(train_ins, [train_loss], updates=updates)
print("complie: _train_with_acc")
_train_with_acc = K.function(train_ins, [train_loss, train_accuracy], updates=updates)
print("complie: _predict")
_predict = K.function(predict_ins, [y_test], updates=state_updates)
print("complie: _test")
_test = K.function(test_ins, [test_loss])
print("complie: _test_with_acc")
_test_with_acc = K.function(test_ins, [test_loss, test_accuracy])

model = Sequential()
model.class_mode = "categorical"
model._train = _train
model._train_with_acc = _train_with_acc
model._predict = _predict
model._test = _test
model._test_with_acc = _test_with_acc

# Train the model each generation and show predictions against the validation dataset
for iteration in range(1, 200):
    print("-" * 50)
    print("Iteration", iteration)
        D_X_train, D_y_train, batch_size=BATCH_SIZE, nb_epoch=1, validation_data=(D_X_val, D_y_val), show_accuracy=True
    # Select 10 samples from the validation set at random so we can visualize errors