@vue-skuilder/db 0.2.4 → 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.
@@ -1589,13 +1589,14 @@ var elo_exports = {};
1589
1589
  __export(elo_exports, {
1590
1590
  default: () => ELONavigator
1591
1591
  });
1592
- var import_common5, ELONavigator;
1592
+ var import_common5, ELO_RELEVANCE_SIGMA, ELONavigator;
1593
1593
  var init_elo = __esm({
1594
1594
  "src/core/navigators/generators/elo.ts"() {
1595
1595
  "use strict";
1596
1596
  init_navigators();
1597
1597
  import_common5 = require("@vue-skuilder/common");
1598
1598
  init_logger();
1599
+ ELO_RELEVANCE_SIGMA = 300;
1599
1600
  ELONavigator = class extends ContentNavigator {
1600
1601
  /** Human-readable name for CardGenerator interface */
1601
1602
  name;
@@ -1635,8 +1636,8 @@ var init_elo = __esm({
1635
1636
  const scored = newCards.map((c) => {
1636
1637
  const cardElo = c.elo ?? 1e3;
1637
1638
  const distance = Math.abs(cardElo - userGlobalElo);
1638
- const rawScore = Math.max(0, 1 - distance / 500);
1639
- const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1639
+ const relevance = Math.exp(-((distance / ELO_RELEVANCE_SIGMA) ** 2));
1640
+ const samplingKey = relevance * (0.5 + 0.5 * Math.random());
1640
1641
  return {
1641
1642
  cardId: c.cardID,
1642
1643
  courseId: c.courseID,
@@ -1648,7 +1649,7 @@ var init_elo = __esm({
1648
1649
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1649
1650
  action: "generated",
1650
1651
  score: samplingKey,
1651
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1652
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), relevance ${relevance.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1652
1653
  }
1653
1654
  ]
1654
1655
  };