kramsretlow / Autologistic.jl

Autologistic regression models in Julia
Other
7 stars 2 forks source link

Integrate with GeoStats.jl framework? #3

Closed juliohm closed 4 years ago

juliohm commented 5 years ago

Hi @kramsretlow! Nice work!

Would you be interested in integrating your solver within the GeoStats.jl framework? It is a perfect fit in my opinion, specially regarding the spatial examples you gave in the docs.

Please let me know if there is any interest from your side, and we can workout the details. There is no need to change anything in your source code. The integration happens thanks to Julia multiple-dispatch after wrapping the low-level function calls in the package into a type that GeoStats.jl can manipulate.

I understand that you can both estimate binary responses as well as simulate samples from the process, is that correct? These two problems are well-defined, and we have a couple of solvers defined: https://github.com/juliohm/GeoStats.jl#problems-and-solvers

kramsretlow commented 5 years ago

Hi @juliohm, thanks for checking out the package. Yes, "spatial logistic regression" is probably the most common application for autologistic models so far, so it definitely matches the mission of GeoStats.jl from that standpoint. Actually I had checked out GeoStats.jl to see if binary models were implemented already 😄

I am interested/willing to connect what I've done with GeoStats.jl. However, I have just left my comfortable (but term-limited) academic position for a job in industry, so if it ends up being a lot of work, progress could be slow.

About the model itself: kriging, Gaussian processes, variogram models, etc. operate with continuous responses on a continuous domain, but the autologistic model is for binary responses on a discrete domain (the vertices in a graph). It's a Markov random field model, a.k.a. a probabilistic graphical model with an undirected graph. I don't know whether this key difference would introduce problems in integration with GeoStats.jl.

Also you mentioned "estimate binary responses." What the package does is estimate model parameters, given a complete set of binary observations over every vertex in the graph (dealing with partially-observed graphs is in the hypothetical future work for now). With the fitted model you can estimate probabilities of interest (usually by simulation), simulate realizations, etc.

If the above considerations don't make integration unreasonable, let's discuss. At the very least Autologistic.jl could be in your list of related packages, for the binary-response case.

Thanks again for your interest.

kramsretlow commented 5 years ago

sorry, I clicked "close and comment" by accident! 😢 Reopening now.

juliohm commented 5 years ago

Hi @kramsretlow , thanks for your interest! The integration is quite straightforward, we just need to add a source file wrapping the methods you implemented in a GeoStats.jl solver. This can be done using Requires.jl so that this integration does not change your list of dependencies for the package. Basically, the source file will only be loaded when both GeoStats.jl and Autologistic.jl are imported by the user.

I will read more carefully the documentation because I've only skimmed it quickly. Regarding the continuous/discrete domains, every domain in GeoStats.jl is finite and represented as some collection of points arranged in space. These plots clarify what I mean: http://juliohm.github.io/GeoStats.jl/latest/plotting/ Some of these domains have the notion of connectivity (the graph you asked) and we can restrict your method to only work with such domains if that is a requirement thanks to the beauty of Julia's type system :+1:

I am going to a conference next week, but afterwards I should be able to come back to this idea :)

Have a good rest of week!

juliohm commented 4 years ago

I will close this issue for now, thank you for the discussion @kramsretlow . I hope to be able to work on this in the future.