Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@martinfleis
Copy link
Member

When converting W code to vectorized Graph code, we made a mistake in the placement of brackets, resulting in deviation form W and GeoDa implementation.

@codecov
Copy link

codecov bot commented Jun 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.4%. Comparing base (e8eb3c7) to head (aba805e).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #789   +/-   ##
=====================================
  Coverage   85.4%   85.4%           
=====================================
  Files        150     150           
  Lines      16012   16006    -6     
=====================================
- Hits       13673   13669    -4     
+ Misses      2339    2337    -2     
Files with missing lines Coverage Δ
libpysal/graph/_kernel.py 82.4% <100.0%> (ø)
libpysal/graph/tests/test_builders.py 100.0% <ø> (ø)
libpysal/graph/tests/test_kernel.py 99.1% <100.0%> (ø)
libpysal/graph/tests/test_triangulation.py 98.8% <100.0%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@martinfleis
Copy link
Member Author

See also #790 as while this results in the same as W, I am not sure if either of those is correct...

@jGaboardi
Copy link
Member

Can you provide a link to the GeoDa implementation?

@martinfleis
Copy link
Member Author

GeoDa is here https://github.com/GeoDaCenter/geoda/blob/0162b8150a949a2d6b8853eec546d48e25ab79f9/Weights/DistUtils.cpp#L361 but I have also tested that empirically by running GeoDa.

The fix here is matching the W implementation here

c = np.pi * 2
c = c ** (-0.5)
self.kernel = [c * np.exp(-(zi**2) / 2.0) for zi in zs]

Copy link
Member

@jGaboardi jGaboardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch.

@jGaboardi jGaboardi added bug functionality that: returns invalid, erroneous, or meaningless results; or doesn't work at all. graph labels Jun 3, 2025
@martinfleis martinfleis merged commit 061942b into pysal:main Jun 5, 2025
12 checks passed
@martinfleis martinfleis deleted the gaussian-bug branch June 5, 2025 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug functionality that: returns invalid, erroneous, or meaningless results; or doesn't work at all. graph

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants