Amazon Personalize
Developer Guide

HRNN Recipe

Amazon Personalize has implemented a hierarchical recurrent neural network (HRNN), which is able to model the changes in user behavior.

Temporal modeling is important in recommendation systems because user intent and interests tend to change or drift with time. This drifting is hard to model with traditional approaches. For example, a common approach in factorization machines is to manually come up with a discounting function for distant interactions (distance measured by time). Such manual engineering of weights is human-effort intensive and is prone to inaccuracy. The Amazon Personalize HRNN model, on the other hand, can take ordered user histories and make correct inferences. HRNN uses a gating mechanism to model the discount weights as a learnable function of the items and timestamp. The hierarchical component further improves temporal model efficiency and leads to higher accuracy.

From a usage perspective, Amazon Personalize has already derived the features for each user from the dataset you provided. If you have done real time data integration, these features are updated in real time according to user activity. Thus, you only provide user-id at inference. While the system does not throw an error if you also provide an item-id, the system neglects the value and the value does not impact the results.

This predefined recipe has the following properties:

  • Nameaws-hrnn

  • Recipe ARNarn:aws:personalize:::recipe/aws-hrnn

  • Algorithm ARNarn:aws:personalize:::algorithm/aws-hrnn

  • Feature Transformation ARNarn:aws:personalize:::feature-transformation/JSON-percentile-filtering


The following table lists the hyperparameters used in the recipe. For each hyperparameter the name, default value, and description are given, as well as the following properties:

  • Range: [lower bound, upper bound]

  • Value type: Integer, Continuous (float), Categorical (boolean, list, string)

  • HPO tunable: Can the parameter participate in hyperparameter optimization (HPO)?

Name Default value Range Value type HPO tunable Description
hidden_dimension 43 [32, 256] integer Yes Number of hidden variables in the model.
bptt 32 [1, 32] integer No Backpropagation through time.
recency_mask true true/false boolean Yes

true: Models for temporal drift in user behavior.

false: Treats all past interactions the same.

min_user_history_length_percentile 0.0 [0.0, 1.0] float No The minimum percentile of user history lengths to include in model training. The history length is the amount of available data for a user.
max_user_history_length_percentile 0.99 [0.0, 1.0] float No

The maximum percentile of user history lengths to include in model training.

For example, min_hist_length_percentile = 0.05 and max_hist_length_percentile = 0.95 includes all users except the bottom and top 5% with respect to their history lengths.