Skip to content

Fix duplicate covariance normalization in computeWassersteinDistanceGaussian - #18

Draft
JokerJohn with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-unbiased-estimator-covariance
Draft

Fix duplicate covariance normalization in computeWassersteinDistanceGaussian#18
JokerJohn with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-unbiased-estimator-covariance

Conversation

Copilot AI commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

computeWassersteinDistanceGaussian 中,协方差矩阵被再次除以 (num_points - 1),与上游已完成的无偏估计处理重复,导致协方差被过度缩放。该 PR 去除重复归一化,保持 Wasserstein 距离使用已标准化的 VoxelInfo::sigma

  • 问题定位

    • VoxelInfo::sigma 在 voxel 构建/熵计算流程中已做 (n-1) 归一化。
    • Gaussian Wasserstein 计算阶段再次除以 (n-1),造成重复无偏处理。
  • 代码修改(最小变更)

    • 文件:map_eval/src/voxel_calculator.cpp
    • 函数:computeWassersteinDistanceGaussian(const VoxelInfo&, const VoxelInfo&)
    • 变更:
      • sigma1 = voxel1.sigma / (voxel1.num_points - 1);sigma1 = voxel1.sigma;
      • sigma2 = voxel2.sigma / (voxel2.num_points - 1);sigma2 = voxel2.sigma;
  • 行为影响

    • Wasserstein 距离改为基于已归一化协方差计算,避免重复缩放带来的数值偏差。
    • 不改变函数接口或调用路径,仅修正内部协方差使用方式。
// before
sigma1 = voxel1.sigma / (voxel1.num_points - 1);
sigma2 = voxel2.sigma / (voxel2.num_points - 1);

// after
sigma1 = voxel1.sigma;
sigma2 = voxel2.sigma;
Original prompt

This section details on the original issue you should resolve

<issue_title>computeWassersteinDistanceGaussianz中的无偏估计协方差矩阵再次除(voxel2.num_points - 1)</issue_title>
<issue_description>作者你好,我想请教一下:
voxel_calculator.cpp中的128行sigma2 = voxel2.sigma / (voxel2.num_points - 1);
voxel2.sigma的值不是在48行或者84行已经进行无偏处理了吗?这里再次除 (voxel2.num_points - 1)的考虑是什么呢?</issue_description>

<agent_instructions>check if this issue exits?</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix unbiased estimator covariance matrix in computeWassersteinDistanceGaussian Fix duplicate covariance normalization in computeWassersteinDistanceGaussian Mar 22, 2026
Copilot AI requested a review from JokerJohn March 22, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

computeWassersteinDistanceGaussianz中的无偏估计协方差矩阵再次除(voxel2.num_points - 1)

2 participants