[ENH][DOC] local join count and LOSH statistics #139
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose of PR
This PR addresses bullet point 1, 5, and 6 of #61. Specifically, this PR adds four new functions to estimate:
losh
)Local_Join_Count
)Local_Join_Count_BV
)Local_Join_Count_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
Two notebooks are included in the PR. Each notebook briefly reviews the core math of the statistic and explains how a user might deploy the statistic in a geospatial workflow. The included examples match those found in
R
spdep::LOSH
andspdep::LOSH.cs
as well as the GeoDa Local Join Counts tutorial.All functions include docstrings and doctests that use built-in PySAL example datasets.
Tests
I have added in four .py test files that execute successfully on my fork. These new tests follow the lead of the existing tests, specifically
test_moran.py
for the LOSH function andtest_join_counts.py
for the local join count functions.Notes for PR consideration
n_jobs=1
to avoid issues fixed in potential merges. Users may enter values other than 1.commpop
, appears to have a dead link at the moment. Having trouble loading this as alibpysal.example
. Once this dataset is working the doctest can be updated. Currently hosting it on a personal Github link.