-
Notifications
You must be signed in to change notification settings - Fork 56
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
[ENH][DOC] local Geary statistics #145
Conversation
Codecov Report
@@ Coverage Diff @@
## master #145 +/- ##
==========================================
+ Coverage 77.61% 80.14% +2.53%
==========================================
Files 25 37 +12
Lines 3274 3758 +484
==========================================
+ Hits 2541 3012 +471
- Misses 733 746 +13
Continue to review full report at Codecov.
|
A few slight changes in 449e767, specifically:
|
Hi Jeff, I'm using this branch to do carry out some spatial autocorrelation. @ljwolf may have noticed this already but setting n_jobs > 1, causes the issue described in #146 - the quick fix described in #146, does not work here since the argument for |
@hh2110 thanks for catching that! I will take a look at it today and get back to you ASAP. |
@hh2110 thanks again for the catch - I appreciate your code review and noting of the issue! The import libpysal as lp
import geopandas as gpd
guerry = lp.examples.load_example('Guerry')
guerry_ds = gpd.read_file(guerry.get_path('Guerry.shp'))
w = libpysal.weights.Queen.from_dataframe(guerry_ds)
y = guerry_ds['Donatns']
lG = Local_Geary(connectivity=w, n_jobs=2, keep_simulations=False).fit(y)
lG.p_sim[0:5]
|
Thanks @jeffcsauer. One more thing please: I am analysing a 400x400 matrix using the Local_Geary.fit function. For this large array, I noticed that there was a time consuming step in Line#169 in local_geary.py: I think you can replace this line
with
The |
@hh2110 taking a look at your suggestion this morning - will report back results! I think you may be onto something as a similar type of improvement has been implemented in the |
@hh2110 another great catch! 🚀 I first checked to make sure that I've pushed your suggested change in both |
I've fixed up imports and renamed things to conform to the other This is some very high-quality work, @jeffcsauer and I'm sorry we couldn't get it merged sooner! |
This is ready to ship. It has notebooks, documentation, and conforms to style. |
No worries at all - thanks for the kind comments and mentorship! 😃 |
Purpose of PR
This PR addresses bullet point 7 and 8 of #61. Specifically, this PR adds two new functions to estimate:
Local_Geary
)Local_Geary_MV
)Each function is written in the form of a scikit-learn style estimator. PEP8 formatting has been applied to all of the functions, although a handful of lines are left long due to readability.
Documentation
One notebook is included in the PR. The notebook reviews the core math of the statistic and explains the basic use of the statistic following examples provided by Anselin (2017).
All functions include docstrings and doctests that use built-in PySAL example datasets.
Tests
I have added in two .py test files that execute successfully on a branch specifically for the Geary estimators. These new tests follow the lead of the existing tests, specifically
test_moran.py
.Notes for PR consideration
_crand()
engine.