window transform: difference, ratio, first and last drop the trailing outputs of each series
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 88/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, node.js
- Área
- data-visualization, frontend
Línea de trabajo
Lee src/transforms/window.js e inspecciona reduceDifference, reduceRatio, reduceFirst y reduceLast. Compara los límites de sus bucles en modo estricto y no estricto con el comportamiento descrito en los ejemplos. Añade o actualiza pruebas para las salidas finales en ambos modos y luego ejecuta las pruebas pertinentes de la transformación window. Se considerará terminado cuando estos reducers produzcan las salidas completas esperadas, incluidas las ventanas finales recortadas cuando strict es false.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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/
- Lenguaje dominante
- HTML
- Estrellas
- 5.4k
- Forks
- 251
- Merge medio
- 2 d 1 h
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de observablehq/plot
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
observablehq/plot#2471 ·
-
[Types] Wrong recursion in Mark’s _tip_ optionQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
observablehq/plot#2459 · 1 reacción ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
observablehq/plot#2453 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
observablehq/plot#2447 · 2 comentarios ·
-
Channel documentation with a section describing zQuizá libre de nuevo @LeonxLJX la tomó hace 67 días y no hay ningún pull request abierto. Abiertodocumentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
observablehq/plot#1533 · 3 comentarios · 1 reacción ·
Todos los issues de observablehq/plot
Issues similares
-
partial() returns wrong values (silently) when train is a matrix and pred.var has two variablesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
bgreenwell/pdp#140 · 1 comentario · 1 reacción ·
-
bin: stop can round 1 ulp below extent[1], so the maximum value is binned as +Infinity and droppedAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
Numeric tick formatter gives repeated labels in scientific notation and with bounds: 'data'Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
bug data order-flow studies
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
userFRM/egui-charts#2530 ·
Los mantenedores suelen responder en 1 día
-
Analysis Functions bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
AllenInstitute/MIES#2856 ·
Los mantenedores suelen responder en 1 día