Loads data and train the model for recommendation.

train_data Training data.
model_spec Specification for the model.
model_spec_options dict, additional options to creat a model.
model_dir str, path to export model checkpoints and summaries.
validation_data Validation data.
batch_size Batch size for training.
steps_per_epoch int, Number of step per epoch.
epochs int, Number of epochs for training.
learning_rate float, learning rate.
gradient_clip_norm float, clip threshold (<= 0 meaning no clip).
shuffle boolean, whether the training data should be shuffled.
do_train boolean, whether to run training.
max_history_length int, max history length as model input (for inference).

An instance based on Recommendation.