refactor: add weighted skill coverage scoring to recommendation engine#218
refactor: add weighted skill coverage scoring to recommendation engine#218Pranav-IIITM wants to merge 4 commits into
Conversation
Fixes komalharshita#98 - utils/recommender.py: score now multiplied by coverage ratio (matched / total project skills) so partial skill matches rank lower than full matches - tests/test_basic.py: added four coverage-weighted unit tests, cleaned up duplicate imports - docs/architecture.md: updated scoring description to reflect new formula
|
@Pranav-IIITM is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @komalharshita, could you please review this PR when you get a chance? |
|
@komalharshita Please review the PR |
komalharshita
left a comment
There was a problem hiding this comment.
Excellent contribution overall. This PR meaningfully improves recommendation quality by introducing coverage-weighted skill scoring instead of relying on flat skill-match counts.
The updated scoring model better differentiates between:
- partial skill overlap
- strong/full project alignment
which should produce more relevant recommendation ordering in practice.
What I especially appreciate:
- strong targeted test coverage
- edge-case handling (
ZeroDivisionError) - architecture documentation updates
- clean implementation scope without unrelated modifications
This is a well-structured backend improvement rather than a superficial scoring tweak.
A few future considerations (non-blocking):
- the scoring system now returns floats instead of integers, so downstream formatting/assumptions should be verified
- the current formula may heavily penalize projects with larger skill lists, which may need tuning over time
- higher-level recommendation-ordering tests could be useful in the future
Overall, this is a strong and thoughtful improvement to the recommendation engine.
Approved for merge.
|
@Pranav-IIITM do ensure all checks pass |
- Add WEIGHT_SKILL, WEIGHT_LEVEL, WEIGHT_INTEREST, WEIGHT_TIME constants to recommender.py to fix ImportError across all Python versions - Implement coverage-weighted skill scoring with zero-division guard - Update test assertions to use pytest.approx() for float-safe comparisons - Fix coverage-isolation tests to prevent accidental criteria matching - Fix test_health_check to use get_client() instead of missing fixture Fixes CI failures on Python 3.9, 3.11, 3.12 All 34 tests passing Related: komalharshita#218
|
Hi @komalharshita! All CI checks are now passing
The only remaining item is the Vercel check, which is blocked on Could you re-approve so we can get this merged? |
Summary
This PR is submitted as part of GSSoC 2026.
The recommendation engine previously awarded a flat 3 points per matching skill, meaning a user who knew 1 of 2 required skills scored the same as one who knew both. This PR introduces a coverage ratio so partial skill matches rank proportionally lower than full matches, producing more accurate project rankings.
Related Issue
Closes #98
Type of Change
What Was Changed
utils/recommender.pymatched / total project skills); added zero-division guard for projects with no skillstests/test_basic.pydocs/architecture.mdHow to Test This PR
Clone this branch:
Install dependencies:
Run the tests:
Expected test output:
Test Results
Self-Review Checklist
refactor/python tests/test_basic.pyand all tests passflake8 .locally and there are no errorsprint()orconsole.log()debug statementsNotes for Reviewer
This refactor preserves the existing recommendation workflow while improving ranking accuracy for partial skill matches. Full matches continue to receive the highest weighting, while incomplete matches are now scaled proportionally using project skill coverage.