@vue-skuilder/db 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1786,13 +1786,14 @@ var elo_exports = {};
1786
1786
  __export(elo_exports, {
1787
1787
  default: () => ELONavigator
1788
1788
  });
1789
- var import_common5, ELONavigator;
1789
+ var import_common5, ELO_RELEVANCE_SIGMA, ELONavigator;
1790
1790
  var init_elo = __esm({
1791
1791
  "src/core/navigators/generators/elo.ts"() {
1792
1792
  "use strict";
1793
1793
  init_navigators();
1794
1794
  import_common5 = require("@vue-skuilder/common");
1795
1795
  init_logger();
1796
+ ELO_RELEVANCE_SIGMA = 300;
1796
1797
  ELONavigator = class extends ContentNavigator {
1797
1798
  /** Human-readable name for CardGenerator interface */
1798
1799
  name;
@@ -1832,8 +1833,8 @@ var init_elo = __esm({
1832
1833
  const scored = newCards.map((c) => {
1833
1834
  const cardElo = c.elo ?? 1e3;
1834
1835
  const distance = Math.abs(cardElo - userGlobalElo);
1835
- const rawScore = Math.max(0, 1 - distance / 500);
1836
- const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1836
+ const relevance = Math.exp(-((distance / ELO_RELEVANCE_SIGMA) ** 2));
1837
+ const samplingKey = relevance * (0.5 + 0.5 * Math.random());
1837
1838
  return {
1838
1839
  cardId: c.cardID,
1839
1840
  courseId: c.courseID,
@@ -1845,7 +1846,7 @@ var init_elo = __esm({
1845
1846
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1846
1847
  action: "generated",
1847
1848
  score: samplingKey,
1848
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1849
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), relevance ${relevance.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1849
1850
  }
1850
1851
  ]
1851
1852
  };