mehaksachdeva's Blog

Coding week #5

mehaksachdeva
Published: 07/04/2019

What did I do this week?

This week I tested the Binomial MGWR model using a simulated dataset with three cases - single independent variable, multiple independent variables and a global model to check with the Binomial global model. The test results compared to the existing GWR model but the bandwidths observed were not as expected for both. The scores for AIC, AICc and BIC were similar for the MGWR model as for the GWR model. After theoretical research on Binomial GAMs, I concluded that the approach was in sync with the theory and should result in comparable results. I also edited the Poisson model tests and example notebooks this week. I also performed a Monte Carlo simulation for it to test the output distribution of the parameters. The binomial model though on track, needs further exploration and resolution of a few outstanding tasks. I am maintaining the Pull request for the simulated data example for Poisson MGWR and the code base changes to accommodate these models (https://github.com/pysal/mgwr/pull/60 ).

What is coming up next?

In the coming week I will work on testing the Binomial MGWR model with simulated data and finalize the approach for the Binomial model. I will also plan for the next part of the project which is to enable predictions from the model at unsampled locations and think about how to introduce that functionality.

Did I get stuck anywhere?

No major issues were encountered in testing the Poisson and Binomial model using simulated data this week. The results were as expected and comparable to the GWR and global models. The Binomial MGWR model still needs more example cases which will be updated till next week.

Looking forward to the progress update next week!

View Blog Post

Coding week #4

mehaksachdeva
Published: 06/25/2019

What did I do this week?

This week I tested the Poisson MGWR model using a simulated dataset with three cases - single independent variable, multiple independent variables and a global model to check with the Poisson global model. The tests performed as expected and the results were all as expected. The scores for AIC, AICc and BIC were a little different from what was expected, but after testing it was realized that the simulated data was not the best use-case for a multiple bandwidth test case. I also tried the Binomial MGWR model this week. Though it ran without errors and converged, the results are not as expected. This model needs further exploration and resolution of a few outstanding tasks. I opened a Pull request for the simulated data example for Poisson MGWR (https://github.com/pysal/mgwr/pull/56 ) and for the code base changes to accommodate these models (https://github.com/pysal/mgwr/pull/57 ).

What is coming up next?

In the coming week I will work on testing the Binomial MGWR model and resolve the issues in the results. I will also plan for the next part of the project which is to enable predictions from the model at unsampled locations and think about how to introduce that functionality.

Did I get stuck anywhere?

No major issues were encountered in testing the Poisson model using simulated data this week. The results were as expected and comparable to the GWR and global models. The Binomial MGWR model still needs further work and resolution of some issues.

Looking forward to the progress update next week!

View Blog Post

Coding week #3

mehaksachdeva
Published: 06/18/2019

What did I do this week?

This week I was able to make changes to the existing functions within the MGWR functionality to accommodate changing the family of the dependent variable to Poisson. The results for a univariate model check using a data-set from the repository gave expected results very similar (difference to the order of 1e-06, which was deemed acceptable in the model) to the already existing Poisson GWR model. The proposed model changes and checks with the existing functions are also provided in a notebook within this open pull request (https://github.com/pysal/mgwr/pull/56).

What is coming up next?

In the coming week I will work on testing this model with simulated data to better enhance understanding of the model performance with multiple variables. Adding on to this, implementation of the MGWR model with logit dependent variables will  be implemented and tested this week.

Did I get stuck anywhere?

No major issues were encountered in implementing the Poisson model functions this week. The results were as expected and promising for further development.

Looking forward to the progress update next week!

View Blog Post

Coding week #2

mehaksachdeva
Published: 06/11/2019

What did I do this week?

This week I implemented an independent module for the algorithm as hypothesized in the proposal. Though the model ran and the loop converged, the betas and the bandwidths from the model using a single variable did not coincide with the results from the already implemented Geographically Weighted Poisson Regression (GWPR) function. On discussion with the mentors on what could be going wrong, we decided to go forward with a different approach. This approach would entail changing the functions within the MGWR implementation to allow calling the function with the family attribute set to Poisson. This model with one variable is expected to result in the same bandwidth and beta values as from the GWPR model.

What is coming up next?

In the coming week I will work on debugging the implementation of the selector function and the MGWR fit function to allow the family attribute to be set to Poisson. The results from that model will then be checked with the GWPR model results.

Did I get stuck anywhere?

No major issues were encountered in the coding of the algorithm this week. The results were not as expected but it revealed further enhancements in the methodology that need to be made.

Looking forward to the progress update next week!

View Blog Post

Coding week #1

mehaksachdeva
Published: 06/04/2019

What did I do this week?

I started with expanding and understanding a module within the PySAL package that estimates GWR models with Poisson response variables. My initial understanding was that updating and changing the functions while using the core functionality in the module to accommodate parameters from the MGWR model would be the way forward to enable its implementation for the MGWR model. It soon became that this approach would not work for more than one predictor variables in the model. The next approach I attempted was to use the existing functionality in the MGWR module to enable changing the family to Poisson() and implementing the hypothesized algorithm. On a detailed call with the mentors, it was realized that integration within the existing module could be challenging given the current design restricted to only Gaussian response variables for MGWR. Some functions would need to be re-written and new functions to handle parameters differently would be needed to supplement the algorithm and it was suggested that integration could follow once the algorithm is tested and finalized. On a discussion with regard to the algorithm suggested in the proposal it was also realized that the various estimations and updates implemented in the iterations needed to be theoretically checked and stated clearly.

What is coming up next?

In the coming week I will work on coding a separate module calling the functions as needed and creating new functions for implementing some already existing functionality to accommodate the Poisson implementation for MGWR. Once the algorithm is tested and the implementation gives the expected output, I will work toward integrating the algorithm in the package. Alongside, I will also work on rechecking the equations from the proposal to ensure they are theoretically sound and that they read clearly.

Did I get stuck anywhere?

This week I got stuck in a few places which led to an enhanced understanding about the functions, dependencies and module architecture. The attempts to implement the algorithm using the preexisting functions also made the differences between the existing implementation and required changes in the functions to accommodate the new implementation clearer. Detailed discussions with the mentors really helped me through the blocks and led to a defined way forward.

Excited to be learning new things everyday and for the progress update next week!

View Blog Post