Recommenders Deep & Cross Network

Hello World,

I am currently in the middle of an internship project. I am doing a Recommender System and now I am developing a solution using Tensor Flow Recommenders.

As I have a large number of features for my products I decided to use the Deep & Cross Network Model, having adapted the code in the tutorials to my dataset.

I can currently run all the code, and it gives really good RMSE values, but I am struggling with adapting the code from the Retrieval Model tutorial to get recommendations from the DCN Model.

Is this DCN Model enough to provide recommendations? Do I need to fit it into another structure (User Model, Query Model, Product Model, Candidate Model)?

Basically all I want is to get recommendations from this, giving the User ID as an input. If anyone of you wants to help me I will compensate you.

Thank you in advance

1 Like


I believe this might be what you are after, the example works on generating recommendations from the tutorials with the use_timestamp features:

index = tfrs.layers.factorized_top_k.BruteForce(model.query_model)

index.index_from_dataset(, movies.batch(100).map(model.candidate_model)))


query = dict(pd.DataFrame({‘user_id’: [“42”],‘timestamp’:[879024327]}).iloc[0].map(lambda x: tf.expand_dims(x,axis=0)))

Get recommendations.

_, titles = index(query)

print(f"Recommendations for user 42: {titles[0, :5]}")