recommenders icon indicating copy to clipboard operation
recommenders copied to clipboard

Add User Feature in the "Recommending movies: retrieval"

Open yyipkei opened this issue 3 years ago • 4 comments

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.

yyipkei avatar Mar 15 '21 16:03 yyipkei

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.

dgoldenberg-audiomack avatar Mar 26 '21 18:03 dgoldenberg-audiomack

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,
        )

YannisPap avatar Apr 14 '21 15:04 YannisPap

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).

Flipper-afk avatar Apr 15 '21 03:04 Flipper-afk

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.

almirb avatar Nov 26 '21 18:11 almirb