Explore non-additive flow metrics and weighted aggregation

オープン
#125 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
15/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
活発
技術スタック
typescript

調査の方向性

This is exploratory design work, not a ready task. Start by reading PR #22 and its weighted aggregation discussion to see why its weights are lost and why location aggregation uses the computed metric. Then review the data aggregation layer, covering the local and worker data providers, to see where sum-based combining happens. Done means agreed semantics for weighted means, location summaries, and time aggregation, not a patch.

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

説明

Flowmap.gl currently sums flow magnitudes when combining flows. This is appropriate for trips, people, goods, or money, but produces misleading results for non-additive metrics such as average journey time, average cost per trip, or a performance score weighted by trip volume.

This issue preserves the use case explored by @arashkav in #22 and its weighted aggregation example. The contribution identified a useful limitation. A future implementation should start from an active application's requirements and a representative dataset; this issue is exploratory, rather than a commitment to a general aggregation framework.

Example use case

A flow represents an average travel time plus the number of trips underlying that average. When locations merge into clusters, the resulting flow should show the trip-weighted average, and location summaries should remain consistent.

For example, 10 minutes across 100 trips and 20 minutes across one trip combine to (10 * 100 + 20 * 1) / 101 ≈ 10.10 minutes. Summing the averages, averaging them equally, or using the averages themselves as weights gives the wrong result.

Proposed direction

  • Keep sum as the default and preserve existing API behavior and the efficient summation path.
  • Initially support only operations justified by the concrete use case, likely sum and weighted mean, with ordinary mean if needed. Avoid exposing arbitrary reducers before their semantics and maintenance cost are understood.
  • Retain sufficient aggregation state: {sum, count} for a mean, or {weightedSum, weightSum} for a weighted mean. Combine that state and finalize to a display value only when needed. A finalized average alone cannot be correctly aggregated again.
  • Define how the metric affects flow thickness, ranking, legends, and tooltips. Decide separately what location summaries represent and what weights determine cluster positions; an average delay need not determine a location's geographic influence.
  • Apply the chosen semantics consistently to clustered flows, duplicate origin–destination rows without clustering, location summaries, time aggregation, and filtered/global summaries. If a summary is not meaningful for a metric, define that explicitly.
  • Keep the implementation in the data aggregation layer and account for local and worker data providers. Preserve numeric and string location IDs without coercing one into the other.

The public API should follow from those decisions; the accessor names and callback signature proposed in #22 are not requirements.

Lessons from #22

The existing PR needs redesign rather than a rebase. In particular, aggregation weights are lost when flows become aggregate records, and subsequent location aggregation uses the computed metric as its weight. The non-clustered and time aggregation paths also continue to sum. These are mathematical and behavioral consistency issues, beyond the age of the branch.

The PR's move to temporary accumulators and one final aggregation call per group is useful. For means, compact sufficient state can avoid retaining all source values.

Validation for a future implementation

  • Unequal group sizes and weights produce the same result when combined directly or in stages.
  • Clustering, zoom changes, filtering, and time aggregation follow the documented semantics.
  • Numeric and string IDs retain their identity.
  • Empty groups, missing/non-finite values, zero total weight, and any restrictions on weights have explicit behavior and tests.
  • Existing sum behavior and API compatibility remain intact, with representative checks for memory use and calculation cost.

For fixed-resolution applications, preprocessing one value per origin–destination pair and disabling clustering can cover part of the need today. Interactive reclustering is the stronger motivation for core support.

Contributions of concrete datasets and desired visual behavior would help determine the smallest useful scope.

主要言語
TypeScript
スター
143
フォーク
24
平均マージ
1日 4時間
マージ済み PR(30日)
18

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

visgl/flowmap.gl のほかの issue

visgl/flowmap.gl の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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