window transform: difference, ratio, first and last drop the trailing outputs of each series
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, node.js
- Ambito
- data-visualization, frontend
Direzione di ricerca
Leggi src/transforms/window.js ed esamina reduceDifference, reduceRatio, reduceFirst e reduceLast, confrontando i limiti dei loro cicli in modalità strict e non strict con il comportamento descritto negli esempi. Aggiungi o aggiorna i test per gli output finali in entrambe le modalità, quindi esegui i test pertinenti della trasformazione window. Il lavoro è completato quando questi reducer producono gli output completi previsti, incluse le finestre finali ritagliate quando strict è false.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The difference, ratio, first and last window reducers stop their loops early: with strict: true the last full window is missing, and with strict: false the last k - 1 - s truncated windows are missing. Other reducers such as mean fill these positions.
import * as Plot from "@observablehq/plot";
const run = (w, data) => {
const o = Plot.windowY(w, {x: "i", y: "v"});
o.transform(data, [Uint32Array.from(data, (_, i) => i)]);
return Array.from(o.y.transform());
};
const d = [2, 4, 8, 16].map((v, i) => ({i, v}));
console.log(run({k: 2, reduce: "difference", strict: true, anchor: "end"}, d));
console.log(run({k: 2, reduce: "ratio", strict: true, anchor: "end"}, d));
console.log(run({k: 1, reduce: "last", strict: true}, d));
console.log(run({k: 3, reduce: "first", anchor: "start"}, d));
console.log(run({k: 3, reduce: "difference", anchor: "start"}, d));
console.log(run({k: 3, reduce: "mean", anchor: "start"}, d));
node t.mjs
Actual:
[ undefined, 2, 4, undefined ]
[ undefined, 2, 2, undefined ]
[ 2, 4, 8, undefined ]
[ 2, 4, undefined, undefined ]
[ 6, 12, undefined, undefined ]
[ 4.666666666666667, 9.333333333333334, 12, 16 ]
Expected:
[ undefined, 2, 4, 8 ]
[ undefined, 2, 2, 2 ]
[ 2, 4, 8, 16 ]
[ 2, 4, 8, 16 ]
[ 6, 12, 8, 0 ]
[ 4.666666666666667, 9.333333333333334, 12, 16 ]
In a chart, Plot.lineY(data, Plot.windowY({k: 7, reduce: "difference"}, ...)) stops short of the right edge.
Tested with @observablehq/plot 0.6.19 and main 2245188, Node.js v26.13.0.
In src/transforms/window.js, reduceDifference, reduceRatio, reduceFirst and reduceLast use n = I.length - k in the strict branch (should be I.length - k + 1) and n = I.length - k + s + 1 in the non-strict branch (should be I.length - s, with the window clipped to I.length).
Credit: https://ucsbplse.github.io/
- Lingua principale
- HTML
- Stelle
- 5.4k
- Fork
- 251
- Merge medio
- 2g 1h
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di observablehq/plot
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
observablehq/plot#2471 ·
-
[Types] Wrong recursion in Mark’s _tip_ optionForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
observablehq/plot#2459 · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
observablehq/plot#2453 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
observablehq/plot#2447 · 2 commenti ·
-
Channel documentation with a section describing zForse di nuovo libera @LeonxLJX l’ha presa 67 giorni fa e non c’è nessuna pull request aperta. Apertadocumentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
observablehq/plot#1533 · 3 commenti · 1 reazione ·
Tutte le issue di observablehq/plot
Issue simili
-
partial() returns wrong values (silently) when train is a matrix and pred.var has two variablesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
bgreenwell/pdp#140 · 1 commento · 1 reazione ·
-
bin: stop can round 1 ulp below extent[1], so the maximum value is binned as +Infinity and droppedAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
Numeric tick formatter gives repeated labels in scientific notation and with bounds: 'data'Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug data order-flow studies
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
userFRM/egui-charts#2530 ·
I maintainer di solito rispondono entro 1 giorno
-
Analysis Functions bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
AllenInstitute/MIES#2856 ·
I maintainer di solito rispondono entro 1 giorno