Skip to content

fix: apply similarity threshold on raw cosine before normalization - #22

Open
yugalkaushik wants to merge 2 commits into
masterfrom
fix-similarity
Open

fix: apply similarity threshold on raw cosine before normalization#22
yugalkaushik wants to merge 2 commits into
masterfrom
fix-similarity

Conversation

@yugalkaushik

Copy link
Copy Markdown
Collaborator
  • The similarity threshold is now checked on the raw cosine score before normalization, so normalization can no longer stretch a weak pair to 1.0 and let it pass. Floor, normalize, and tag/link/temporal bonuses are kept, but they only rank pairs that already passed.
  • Default similarity threshold raised from 50% to 70%.

export const SEMANTIC_FLOOR = 0.3;

export const DEFAULT_THRESHOLD = 0.5;
export const DEFAULT_THRESHOLD = 0.7;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note: According to its model card, multilingual-e5-small (the model Joplin uses for word embedding) distributes cosine similarity scores in the range [0.7, 1] (related Joplin issue).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good point, thanks for flagging this. The absolute threshold doesn’t really separate related and unrelated pairs for this model. We should use a relative cutoff, with a small absolute floor for tiny vaults

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.

3 participants