tensorflow / recommenders

TensorFlow Recommenders is a library for building recommender system models using TensorFlow.
Apache License 2.0
1.82k stars 273 forks source link

how to return NDCG as a metric #687

Open Lulu20220 opened 1 year ago

Lulu20220 commented 1 year ago

Hello,

I am following the tutorial here https://www.tensorflow.org/recommenders/examples/dcn to build a dcn model, but I want to have ndcg as a metric. Then I did model.compile(optimizer='sgd', metrics=[tfr.keras.metrics.NDCGMetric()])

but still not returning ndcg.

Could someone guide me through here please?

rlcauvin commented 1 year ago

Which metrics is it outputting? RMSE?

patrickorlando commented 1 year ago

@Lulu20220 The custom model defined in the tutorial overrides the default keras train and test steps so passing a metric to compile will not work. You need to pass the metric object to the the Ranking task defined in the DCN model here.