Skip to content

📈 Algorithm update - #1

Merged
chase-manning merged 3 commits into
mainfrom
algorithm-update
Apr 13, 2026
Merged

chase-manning merged 3 commits into
mainfrom
algorithm-update

Conversation

@chase-manning

Copy link
Copy Markdown
Owner

Fix importance weight scaling to use geometric spacing

Problem

The quiz's per-question importance rating (1-5) was used as a raw linear multiplier on each trait's contribution to the match score. This created wildly inconsistent proportional impact across the scale:

Step Ratio increase % increase
1→2 2/1 +100%
2→3 3/2 +50%
3→4 4/3 +33%
4→5 5/4 +25%

Choosing between 1 and 2 doubled a trait's weight, while choosing between 4 and 5 only increased it by 25%. Users perceive each step as equally meaningful, but the math didn't reflect that.

Solution

Replaced the raw linear multiplier with a geometrically-spaced weight lookup table ([1.0, 1.5, 2.24, 3.34, 5.0]), where each step is a consistent ~50% proportional increase. This is derived from r^(importance - 1) with r^4 = 5 (preserving the existing 5:1 max/min dynamic range).

This approach is grounded in the Weber-Fechner law from psychophysics, which shows that humans perceive proportional changes — not absolute ones — as equal. It's also the recommended practice in multi-criteria decision analysis (MCDA) literature for transforming ordinal importance ratings into ratio-scale weights.

Changes

  • Added IMPORTANCE_WEIGHTS lookup table and getImportanceWeight() helper to dog-rating.ts
  • Applied the geometric weight in all 3 places importance is used: rating questions, string checkbox matches, and array checkbox matches
  • No quiz cache version bump needed — importance values are still stored as raw 1-5 and transformed at scoring time

@github-actions

github-actions Bot commented Apr 13, 2026 •

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 990cfd3):

https://dogmatch-33--pr1-algorithm-update-funb46yc.web.app

(expires Mon, 20 Apr 2026 10:10:19 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 3be598a5fc061b587f1c015bd81cd7e7b2c794a8

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates quiz scoring so per-question importance (1–5) is mapped to geometrically spaced weights, making each step produce a consistent proportional impact on match scoring. Also adjusts GitHub Actions workflow permissions for Firebase Hosting deploys.

Changes:

  • Introduced a geometric IMPORTANCE_WEIGHTS table and helper to transform importance ratings into ratio-scale weights.
  • Applied the transformed weight in rating, string checkbox, and array checkbox scoring paths.
  • Added explicit permissions blocks to Firebase Hosting PR/merge workflows.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/app/dog-rating.ts Replaces linear importance multipliers with geometric weights via a shared helper.
.github/workflows/firebase-hosting-pull-request.yml Adds explicit workflow token permissions for PR previews.
.github/workflows/firebase-hosting-merge.yml Adds explicit workflow token permissions for merges to main.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/app/dog-rating.ts Outdated
Comment thread .github/workflows/firebase-hosting-pull-request.yml
Comment thread .github/workflows/firebase-hosting-merge.yml
@chase-manning
chase-manning merged commit 1740c7a into main Apr 13, 2026
2 checks passed
@chase-manning
chase-manning deleted the algorithm-update branch April 13, 2026 10:21
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