window transform: strict median/deviation/variance/pXX check missing values at the wrong rows when there are several series

オープン 初心者向け
#2,471 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, node.js

調査の方向性

src/transforms/window.jsから始め、厳密な欠損値数についてreduceAccessorを調べてください。issueでは、行インデックスと系列インデックスの不一致が指摘されています。提供されたPlot.windowYの例で再現し、window変換のテストで厳密なreducerを確認してください。複数系列で、median、deviation、variance、pXXがmeanと同じ行に欠損結果を配置すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

With strict: true, the median, deviation, variance and pXX window reducers look for missing values at the within-series position instead of the row index, so any series that does not occupy rows 0..n-1 (a second z series, a later facet) gets gaps in the wrong places.

import * as Plot from "@observablehq/plot";

const data = [
  {i: 0, v: 1, g: "a"}, {i: 1, v: 10,   g: "b"},
  {i: 2, v: 2, g: "a"}, {i: 3, v: null, g: "b"},
  {i: 4, v: 3, g: "a"}, {i: 5, v: 30,   g: "b"},
  {i: 6, v: 4, g: "a"}, {i: 7, v: 40,   g: "b"}
];

const o = Plot.windowY({k: 2, reduce: "median", strict: true, anchor: "end"}, {x: "i", y: "v", z: "g"});
o.transform(data, [Uint32Array.from(data, (_, i) => i)]);
console.log(Array.from(o.y.transform()));

node t.mjs

Actual:

[ undefined, undefined, 1.5, 10, 2.5, 30, NaN, NaN ]

Expected (what reduce: "mean" gives on the same data):

[ undefined, undefined, 1.5, NaN, 2.5, NaN, 3.5, 35 ]

Series "a" has no missing values but loses its last window, and series "b" gets values for the two windows that contain null.

Tested with @observablehq/plot 0.6.19 and main 2245188, Node.js v26.13.0.

In reduceAccessor in src/transforms/window.js, v takes a row index but the strict NaN counting calls v(i) and v(i + k - 1); it should be v(I[i]) and v(I[i + k - 1]).

Credit: https://ucsbplse.github.io/

主要言語
HTML
スター
5.4k
フォーク
251
平均マージ
2日 1時間
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

observablehq/plot のほかの issue

observablehq/plot の issue をすべて見る

似ている issue

Data Visualization の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。