NTMC-Community / MatchZoo

Facilitating the design, comparison and sharing of deep text matching models.
Apache License 2.0
3.82k stars 898 forks source link

DSSM model.predict() scores rank does not match with the rank by dot layer cosine similarity #848

Open jchen0529 opened 2 years ago

jchen0529 commented 2 years ago

Describe the Question

I have a trained DSSM model and wanted to compare the ranked items based on dssm model.predict() scores against the cosine similarity scores after the model's dot layer, I would expect the two ranks to be the same since model.predict() is just the final score after a linear activation but the results are completely the opposite and I'm trying to understand how that might be given the linear coefficient from the final dense layer is positive.

Describe your attempts

1. DSSM model summary 2. Predicted scores comparison 3. Predicted dataframe with two sets of scores, sorted by pred_score here which gives completely opposite rank compared to if sorted by dot score