recommenders
recommenders copied to clipboard
Add User Feature in the "Recommending movies: retrieval"
Hi all,
I'm testing the "Recommend Movies: Retrieval" tutorial with my own data. May I know how to add additional user features (such as gender, age, etc) to this model?
Thanks.
I would agree that it would be very helpful to have an example which adds a few features on both the user side and item side.
I believe you can add additional features to the user model. e.g.
class UserModel(keras.Model, ABC):
def __init__(self):
super().__init__()
self.session_id_embedding = keras.Sequential(
[
preprocessing.Hashing(num_bins=200_000),
layers.Embedding(input_dim=200_000, output_dim=32),
]
)
self.another_embedding = keras.Sequential(
[
preprocessing.Hashing(num_bins=200_000),
layers.Embedding(input_dim=200_000, output_dim=32),
]
)
def call(self, inputs):
return tf.concat(
[
self.session_id_embedding(inputs["session_id"]),
self.another_embedding(inputs["another_feature"]),
],
axis=1,
)
There's a nice tutorial in the next section called "Using rich feature". Please have a look at Feature Preprocessing (basically covers most types of input).
There's a nice tutorial in the next section called "Using rich feature". Please have a look at Feature Preprocessing (basically covers most types of input).
It would be nice If the tutorial added movie genre as an example to enhance retrieval/rating.