def train_keras(batch_size, epochs, n_classes):
    ((x_train, y_train), (x_test, y_test)) = tf.keras.datasets.mnist.load_data()
    x_train = x_train.reshape(x_train.shape[0], image_height, image_width, 1)
    x_test = x_test.reshape(x_test.shape[0], image_height, image_width, 1)
    input_shape = (image_height, image_width, 1)
    x_train = x_train.astype('float32')
    x_test = x_test.astype('float32')
    x_train /= 255
    x_test /= 255
    y_train = tf.keras.utils.to_categorical(y_train, n_classes)
    y_test = tf.keras.utils.to_categorical(y_test, n_classes)
    simple_cnn_model = simple_cnn(input_shape)
    simple_cnn_model.fit(x_train, y_train, batch_size, epochs, (x_test, y_test))
    (train_loss, train_accuracy) = simple_cnn_model.evaluate(x_train, y_train, verbose=0)
    print('Train data loss:', train_loss)
    print('Train data accuracy:', train_accuracy)
    (test_loss, test_accuracy) = simple_cnn_model.evaluate(x_test, y_test, verbose=0)
    print('Test data loss:', test_loss)
    print('Test data accuracy:', test_accuracy)
def train_keras(batch_size, epochs, n_classes):
    ((x_train, y_train), (x_test, y_test)) = tf.keras.datasets.mnist.load_data()
    x_train = x_train.reshape(x_train.shape[0], image_height, image_width, 1)
    x_test = x_test.reshape(x_test.shape[0], image_height, image_width, 1)
    input_shape = (image_height, image_width, 1)
    x_train = x_train.astype('float32')
    x_test = x_test.astype('float32')
    x_train /= 255
    x_test /= 255
    y_train = tf.keras.utils.to_categorical(y_train, n_classes)
    y_test = tf.keras.utils.to_categorical(y_test, n_classes)
    simple_cnn_model = simple_cnn(input_shape)
    simple_cnn_model.fit(x_train, y_train, batch_size, epochs, (x_test, y_test))
    (train_loss, train_accuracy) = simple_cnn_model.evaluate(x_train, y_train, verbose=0)
    print('Train data loss:', train_loss)
    print('Train data accuracy:', train_accuracy)
    (test_loss, test_accuracy) = simple_cnn_model.evaluate(x_test, y_test, verbose=0)
    print('Test data loss:', test_loss)
    print('Test data accuracy:', test_accuracy)