-
Notifications
You must be signed in to change notification settings - Fork 78
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
lag_spatial #545
Comments
In the new If there is a need to directly support sparse arrays, rather than using then under the hood via the |
I would definitely suggest keeping the existing function, since removing it would break all kinds of stuff in spreg (and probably in other older code as well). Adding a check in the existing lag_spatial should be straightforward and it could also support graph.Graph without breaking anything. |
@lanselin do you have any interest in us taking a look at spreg to explore adopting the new Graph internally (eventually) over there? Any internal change would be invisible to users and any external change (e.g. how to manually add a lag variable to a dataframe, etc) would have a good deprecation period and a lot of exposure across the entire ecosystem to help demonstrate the new convention One of the design principles for the new Graph is that it must be compatible with the way spreg does things, so we're spending a lot of cycles on things like keeping the W/sparse representations aligned so that things like lag operators and higher-order neighbors etc dont break anything in spreg. We liked the idea of method chaining on the weights, and the Graph will still have a We're trying to do a 1:1 backwards-compatibility check, with spreg in mind, specifically. We've got a 'to_W` to help with testing against the old implementation. We could start a parallel branch of spreg that makes use of the new Graph but runs all the old spreg tests so that it surfaces anything unexpected? If we start digging in now, it might help us make some better design decisions about the Graph I'm using a lot of spreg at the moment, so i'm happy to do all the heavy lifting and coordinate with you and @pedrovma. But i also dont want to waste your time if you dont want to go that route |
@knaaptime, you should know that @pedrovma and I are currently working on a lot of new functionality for spreg in a private branch of spreg. As we usually proceed, we implement all new code locally and then move it to the main branch for any remaining adjustments in tests etc. that are usually required. Specifically, we have cleaned up and streamlined all the output listings and are adding an SLX option to all current functions (which implements spatial Durbin, GNS etc. as special cases), also in regimes. Also, some new wrapper classes to simplify the use of spatial error methods and in the pipeline are MESS and a general nonlinear SLX distance function. I would suggest waiting with the Graph implementation in spreg until these changes are committed to the official main branch to avoid later conflicts. We're almost there. I have some new testing notebooks that run all permutations of options (several hundreds ...), very handy. |
fwiw, I think it's easy to throw a check for the new class in lag_spatial() that dispatches to the new Graph.lag() depending on the type of the first input, as @lanselin suggests... we have not yet made a well-defined transition plan, and I definitely think .lag() is a core concern of the transition plan. |
currently lag_spatial requires a libpysal spatial weights object as the argument w. there is no type or dimension checking and the function only contains w.sparse * y. there is some code in spreg that implements spatial lag computations for both libpysal weights and sparse matrices separately. this seems to be duplicative and asking for trouble.
in the new weights setup, is there a way to make lag_spatial agnostic to the type of weights object passed? i.e., make it work with both libpysal weights objects and sparse matrices without having to make this explicit?
just a thought.
The text was updated successfully, but these errors were encountered: