Skip to content

Feature/svd online updating#1645

Open
Prateek2007-cmd wants to merge 6 commits into
leonagoel:mainfrom
Prateek2007-cmd:feature/svd-online-updating
Open

Feature/svd online updating#1645
Prateek2007-cmd wants to merge 6 commits into
leonagoel:mainfrom
Prateek2007-cmd:feature/svd-online-updating

Conversation

@Prateek2007-cmd

Copy link
Copy Markdown

Description

This PR resolves Issue #1596 by implementing Bayesian online updating for the Collaborative Filtering model. Previously, the system lacked a mechanism to efficiently integrate new interactions, often requiring expensive, full Truncated SVD matrix reconstructions for every transaction or going stale.
Closes #1639
Changes included:

  • In-Memory Micro-Updates: Modified the /api/purchases endpoint in backend/main.py to trigger the online_update() SGD method within the loaded CollaborativeRecommender instance. This dynamically nudges the specific user and item latent vectors towards the new interaction error gradient without a full matrix recalculation.
  • Scheduled Nightly Rebuilds: Added a celery_app.conf.beat_schedule in celery_app.py to trigger a new tasks.rebuild_models_task via cron (daily at 3:00 AM UTC). This runs the heavy, full matrix factorization offline during off-peak hours to recalibrate the baseline factors and expand the matrix dimensionality for newly joined users/items.

Related Issues

  • Resolves #1596

Type of Change

  • New Feature (Online Model Updating / Scheduled Retraining)
  • Performance Improvement

Testing

  • Confirmed /api/purchases correctly intercepts the incoming payload and triggers collab_model.online_update in the global cache.
  • Verified celery_app.conf.beat_schedule correctly registers the rebuild_models_task for execution via celery beat.

@github-actions

Copy link
Copy Markdown

🎉 Welcome to Hybrid Recommender, @Prateek2007-cmd! This is your first contribution here!

Labels added: gssoc:approved | mentor:leonagoel | status:review-needed

PR Description Checklist:

NO - What changed section
NO - Why section
NO - How to test section
YES - Related issue linked

⚠️ Some required sections are missing. Please update your PR description.

What happens next:

  1. @leonagoel will review your changes
  2. CI checks must pass
  3. Once approved, this PR will be auto-merged

⏱️ Please respond to review comments within 48 hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicated Inline Scripts & CSS !important Abuse (cart.html)

1 participant