SPB Git forge

spb/resto-ka

Public

Resto·Ka — tous les restaurants du Québec, menus complets et prix réels (famille ·Ka)

52commits 1branches 0releases
11.6 MBsize
maindefault branch
19 days agolast push
Python 69.3% TypeScript 16.7% CSS 7.9% JavaScript 4.7% HTML 1.4%

feat(ka-id v2.2): boost COLLABORATIVE_MODEL des recommandations du modèle ALS (kaid.py aligné sur ka-ui.git/kaid f844854)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Simon-Pierre Boucher committed 29 days ago (Aug 26, 2026) parent 53e215a

1 changed file +8 −2

modified restoka/kaid.py +8 −2
@@ -292,8 +292,10 @@ def rerank(items: list, user, *, features_of, uid_of=None,
292 292 tail = items[max_considered:]
293 293 n = len(head)
294 294 active = active_dims or set()
295 − # co-favoris des membres semblables (filtrage collaboratif du hub)
295 + # signaux collaboratifs du hub : co-favoris (item-item) et
296 + # recommandations du modèle de matrix factorization (ALS, batch quotidien)
296 297 similar = {str(s) for s in (app_p.get("similar") or [])}
298 + mf = {str(s) for s in (app_p.get("mf") or [])}
297 299 scored = []
298 300 badged = 0
299 301 for i, it in enumerate(head):
@@ -303,9 +305,13 @@ def rerank(items: list, user, *, features_of, uid_of=None,
303 305 profile.get("global") or {}, active)
304 306 except Exception:
305 307 p, reasons = None, []
306 − if similar and str(uid_of(it)) in similar:
308 + uid = str(uid_of(it))
309 + if similar and uid in similar:
307 310 p = min(1.0, (p if p is not None else 0.55) + 0.25)
308 311 reasons = (["SIMILAR_USERS"] + reasons)[:4]
312 + elif mf and uid in mf:
313 + p = min(1.0, (p if p is not None else 0.55) + 0.25)
314 + reasons = (["COLLABORATIVE_MODEL"] + reasons)[:4]
309 315 if p is None:
310 316 final = (1.0 - blend) * base + blend * 0.5
311 317 else:
312 318