-
Notifications
You must be signed in to change notification settings - Fork 80
Add kw arg to normalize kernel in distance weights. #791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #791 +/- ##
=======================================
+ Coverage 85.4% 85.4% +0.1%
=======================================
Files 150 151 +1
Lines 15971 15992 +21
=======================================
+ Hits 13632 13659 +27
+ Misses 2339 2333 -6
🚀 New features to boost your workflow:
|
Can we get it to |
Kernels in PySALThis note collects issues, background, and proposals for refactoring the treatment of kernels in PySAL, especially in relation to bandwidth handling, standardization, and cross-module reuse. BackgroundConceptual OverviewIn nonparametric statistics, kernels are generally used for smoothing. At a given focal point, a weighted average of surrounding observations is computed, with weights that decrease with distance from the focal point. The kernel function defines the distance decay pattern of these weights. In spatial analysis, kernels serve multiple purposes, which can be classified into three conceptual cases:
Current ImplementationLocation: Notation
Kernel TableA
Derivations: Do Kernels Integrate to 1?Triangular✅ Integrates to 1 Uniform✅ Integrates to 1 Quadratic (Epanechnikov)✅ Integrates to 1 Quartic (Biweight)✅ Integrates to 1 Gaussian✅ Integrates to 1 (by definition of the standard normal distribution) Why Set
|
One thing we need to figure out is handling of diagonal filling as a user typically does not know the value of |
100% w/ the In this pattern, when a weight is built & kernel calculated, we set the
|
We've decided against this |
No matter what we do, we need to fix this, so that when distances are calculated, we populate the self-weight with |
Co-authored-by: knaaptime <knaaptime@Mac.attlocal.net>
This is responding to the discussion in #790.
The default
$$K(z) = \frac{1}{\sqrt{2\pi}} e^{-\frac{1}{2} z^2}$$
normalize=True
preserves the current behavior of the Gaussian kernel weights (heavily used inspreg
):Setting
$$K(z) = e^{-\frac{1}{2} z^2}$$
normalize=False
provides an option to use unnormalized Gaussian weights: