skaters 0.12.0 → 0.12.1
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 +7 -0
- package/package.json +1 -1
- package/terminal.mjs +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ tracks the Python [`skaters`](https://pypi.org/project/skaters/) package and is
|
|
|
5
5
|
kept numerically identical to it within `1e-6`, enforced by the parity checker on
|
|
6
6
|
every release.
|
|
7
7
|
|
|
8
|
+
## 0.12.1
|
|
9
|
+
|
|
10
|
+
- Skater state is now pure data (picklable/serialisable for checkpoint-restore
|
|
11
|
+
deployments): the terminal ensemble's per-horizon leaf closures moved out of
|
|
12
|
+
the state dict into the wrapper, mirroring how multiscale holds its
|
|
13
|
+
sub-skaters. No numerical change (parity: 104,678 values, 53 scenarios).
|
|
14
|
+
|
|
8
15
|
## 0.12.0
|
|
9
16
|
|
|
10
17
|
Better default forecaster. `laplace`'s terminal-leaf `scaleAlpha` (the residual-variance
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skaters",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Fast univariate online distributional time-series forecasting: a zero-dependency JavaScript port of the Python skaters package, numerically identical to 1e-6.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|
package/terminal.mjs
CHANGED
|
@@ -20,13 +20,16 @@ export function terminalLeafEnsemble(skaters, {
|
|
|
20
20
|
const d = depths === null ? new Array(n).fill(0) : depths;
|
|
21
21
|
const prior = priorLogWeights === null ? new Array(n).fill(0.0) : priorLogWeights;
|
|
22
22
|
|
|
23
|
+
// Closures live in the wrapper, never in state: skater state stays pure
|
|
24
|
+
// data (serialisable for checkpoint/restore), mirroring terminal.py.
|
|
25
|
+
const tleafs = Array.from({ length: k }, () => leafFn(1));
|
|
26
|
+
|
|
23
27
|
function _skater(y, state) {
|
|
24
28
|
if (state === null || state === undefined) {
|
|
25
29
|
state = {
|
|
26
30
|
sub: new Array(n).fill(null),
|
|
27
31
|
qdist: Array.from({ length: n }, () => []),
|
|
28
32
|
log_w: prior.slice(),
|
|
29
|
-
tleaf: Array.from({ length: k }, () => leafFn(1)),
|
|
30
33
|
leafState: new Array(k).fill(null),
|
|
31
34
|
leafPred: new Array(k).fill(null),
|
|
32
35
|
meanQ: Array.from({ length: k }, () => []),
|
|
@@ -60,7 +63,7 @@ export function terminalLeafEnsemble(skaters, {
|
|
|
60
63
|
const mq = state.meanQ[h];
|
|
61
64
|
if (mq.length >= h + 1) {
|
|
62
65
|
const r = y - mq.shift();
|
|
63
|
-
const [ld, ls] =
|
|
66
|
+
const [ld, ls] = tleafs[h](r, state.leafState[h]);
|
|
64
67
|
state.leafState[h] = ls;
|
|
65
68
|
state.leafPred[h] = ld[0];
|
|
66
69
|
}
|