How to bin integral vs floating point correctly (precision issue and general question)
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- cpp
调研方向
该 issue 没有指定源文件或测试;首先使用整数数据、[min, max+1] 的边界以及空的最后一个 bin,复现浮点精度直方图案例。检查直方图分箱的入口点以及现有的整数范围指导。完成的标准是精度行为和推荐的整数边界已得到解决并记录,同时为报告的案例提供覆盖。
由索引模型根据 Issue 内容生成。
描述
Dear @HDembinski and other authors, thanks for this awesome library. We have just started using it and the speed and versatility are impressive! We have a problem that manifests as a precision problem, but also shows a more general question.
The problem: We use the floating precision histogram to bin any kind of data. When we bin data (gray value camera images) of integer precision, we set lower and upper bound based on the data range to [min, max+1] and the number of bins to upper bound - lower bound. However there are sometimes cases where the numeric precision then leads to an empty last bin. This is due to rounding error, the values fall into max-1 instead of max. We checked and the bin index is then computed as (max-1).999... which finally resolves to max-1. Is there a good solution to this? It leads to confusion that the last bin is empty, and its also a bit problematic in writing tests.
The underlying question: We are not completely certain what is a "recommended" way to set histogram bounds for integral data space. Are there common guidelines? In floating point precision it is more understandable what data range is covered by each bin. But in integral space, it seems the value 0 could be best represented by bin [-0.5, 0.5) rather than the more obvious [0, 1). And help, links or pointers to documentation would be highly appreciated!
- 主要语言
- C++
- 星标
- 334
- 派生
- 75
- 平均合并
- 18 小时 2 分钟
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
boostorg/histogram 的其他 Issue
-
难度 5/5 一周以上 新手友好度 28/100
-
Mixed scalar/array `fill` zeroes the whole histogram when a non-inclusive axis drops the first entry可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 3/5 1-2 天 新手友好度 72/100
-
难度 5/5 一周以上 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
axes should provide strong exception guarantee for metadata可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 4/5 3-5 天 新手友好度 42/100
查看 boostorg/histogram 的全部 Issue
相似的 Issue
-
44-x-y bug :beetle:
难度 1/5 1 小时以内 新手友好度 82/100
electron/electron#55528 · 1 条评论 ·
维护者通常 1 天内回复
-
ai_p2 bug comp-datalake
难度 2/5 1-3 小时 新手友好度 85/100
ClickHouse/ClickHouse#128306 · 1 条评论 ·
维护者通常 1 天内回复
-
70 Instance - Raid - Outland
难度 1/5 1 小时以内 新手友好度 85/100
azerothcore/azerothcore-wotlk#28328 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug-unconfirmed
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复