def compile_and_run_model(mdl, train_data, epochs=20, batch_size=128):
    """
    Compile the Keras NN model, fit and evaluate it
    :param mdl: A build Keras model
    :param train_data: train set for the model
    :param epochs: number of epochs. Default is 20
    :param batch_size: batch size for the training. Default is 128
    :return: list of prediction scores
    """

    mdl.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy'])

    # train the model
    #
    mdl.fit(train_data[0], train_data[1], epochs=epochs, batch_size=batch_size, verbose=0)
    #
    # evaluate the network
    #
    score = mdl.evaluate(train_data[2], train_data[3], batch_size=batch_size)
    print('Test loss:', score[0])
    print('Test accuracy:', score[1])

    print("Predictions for Y:")
    print(mdl.predict(train_data[2][:5]))
    mdl.summary()

    return [score[0], score[1]]