def train(model, x_train, y_train, x_val, y_val, batch, epochs):
    """
    Train the model, and store the learning history

    Keyword argyments
    model -- a network
    batch -- the batch size
    epochs -- number of epochs to run the model for
    """
    history = model.fit(
                x_train,
                y_train,
                batch_size=batch,
                epochs=epochs,
                validation_data=(x_val, y_val),
            )

    return history, model