oracular 0.10.0 → 0.11.0
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.
- package/CHANGELOG.md +6 -0
- package/README.md +3 -2
- package/dist/cli.js +7 -3
- package/dist/index.cjs +6 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.cjs.map +1 -1
- package/dist/presets.js +2 -2
- package/dist/presets.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function lowerBound(alpha, beta, z, bound) {
|
|
|
77
77
|
function repeatFactor(n) {
|
|
78
78
|
return Math.log1p(1 / n) / Math.LN2;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
return (successes +
|
|
80
|
+
function smoothRate(successes, total, rate) {
|
|
81
|
+
return (successes + 2 * rate) / (total + 2);
|
|
82
82
|
}
|
|
83
83
|
function lift(q, b, type = "normalized-difference") {
|
|
84
84
|
if (type === "absolute-difference") return q - b;
|
|
@@ -152,12 +152,13 @@ function signalWeights(state, intent, learning, signal) {
|
|
|
152
152
|
}
|
|
153
153
|
const record2 = getOwn(state.learned, signal) ?? NONE;
|
|
154
154
|
const nWith = record2.hits + record2.misses;
|
|
155
|
-
const qWith = laplace(record2.hits, nWith);
|
|
156
155
|
const totalEpisodes = state.episodes.hits + state.episodes.misses;
|
|
157
156
|
const nWithout = Math.max(0, totalEpisodes - nWith);
|
|
158
157
|
const outcomesWithout = Math.min(nWithout, Math.max(0, state.episodes.hits - record2.hits));
|
|
159
|
-
const
|
|
160
|
-
const
|
|
158
|
+
const base = totalEpisodes === 0 ? 0 : state.episodes.hits / totalEpisodes;
|
|
159
|
+
const qWith = smoothRate(record2.hits, nWith, base);
|
|
160
|
+
const qWithout = smoothRate(outcomesWithout, nWithout, base);
|
|
161
|
+
const baseline = learning.lift === "association-rule" ? smoothRate(record2.hits + outcomesWithout, nWith + nWithout, base) : qWithout;
|
|
161
162
|
const score = learningScore(lift(qWith, baseline, learning.lift), learning.lift);
|
|
162
163
|
const learned = nWith === 0 ? 0 : learning.gain * Math.abs(initial) * score;
|
|
163
164
|
const nEff = nWith + nWithout === 0 ? 0 : nWith * nWithout / (nWith + nWithout);
|