Skip to content

fix mismatch in opinion handling#685

Merged
lthoang merged 1 commit intoPreferredAI:masterfrom
MacchiatoCreamCheese:fix-opinion-in-companion
Mar 29, 2026
Merged

fix mismatch in opinion handling#685
lthoang merged 1 commit intoPreferredAI:masterfrom
MacchiatoCreamCheese:fix-opinion-in-companion

Conversation

@MacchiatoCreamCheese
Copy link
Copy Markdown
Contributor

Description

This change fixes two mismatch in the Companion model’s user–item–aspect–negative opinion (UIAON) in recom_companion.pyx.

  1. Score lookup for the negative-opinion pair
    When the sampled negative opinion o_jdx is present in user_item_aspect_neg_opinion_dict, the code compares i_score to j_score from the same (u,i,a,o) key. That j_score read from user_item_aspect_pos_opinion_dict, which is inconsistent. It now reads from user_item_aspect_neg_opinion_dict, so it are based on the correct dict now.

  2. Gradients
    The UIAON prediction uses G3 (and del_g3 was already updated with G3), but the user-factor loop was backpropagating del_u / del_a / del_o with G2. Those terms now use G3, so gradients align with the tensors used.

Related Issues

N/A

Checklist:

  • I have added tests.
  • I have updated the documentation accordingly.
  • I have updated README.md (if you are adding a new model).
  • I have updated examples/README.md (if you are adding a new example).
  • I have updated datasets/README.md (if you are adding a new dataset).

@lthoang lthoang self-requested a review March 29, 2026 07:41
Copy link
Copy Markdown
Member

@lthoang lthoang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lthoang lthoang merged commit 81e88df into PreferredAI:master Mar 29, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants