U-Shift / Transport-Demand-Modelling

Supporting materials for the Transport Demand Modeling course, lectured by Prof. Filipe Moura.
MIT License
23 stars 15 forks source link

Add explanatory text to nested-logit notebook #22

Closed EwoutH closed 4 months ago

EwoutH commented 7 months ago

Add some explanatory notes to the 01-logit-nested.ipynb notebook. The goal hereby is to explain the concepts behind the code. Also adds a introduction, some interpretation of the results, and a summary.

I hope this is useful, please review on both correctness and readability. Please also let me know if you like this level of detail (or you would like to see more or less).

EwoutH commented 7 months ago

I just see this wasn't the first notebook in the series, but that's 01-biogeme-basics.ipynb . So maybe this is a bit more detailed for this notebook. If needed I can port some changes over.

On the other hand it's the first notebook in the 8.2 series, so a bit of a recap might not be that bad.

EwoutH commented 6 months ago

Hi @temospena! Do you find a PR like this useful?

EwoutH commented 6 months ago

Hi @mncosta, @filmoura and @temospena!

In the next two weeks I will be using biogeme a lot for my master thesis, and these notebooks are really useful for that In the process I don't mind to update a few of these notebooks (it's a good way to get up to speed again since this was a few years ago), but I would need some feedback to check if I'm on the right track.

If this is not useful or not feasible that's perfectly fine, but please let me know.

temospena commented 6 months ago

Hi @EwoutH , thank you for these suggestions., I think they are very useful! We should wait for the comments from @mncosta, as he is the leading author of that chapter. ATM he's a bit busy.

EwoutH commented 6 months ago

Thanks for getting back! Looking forwards to his thoughts.


Currently researching objective and subjective cycling safety using machine learning 🚲 💻

@mncosta totally off topic, but very interesting research! I encountered this report (PDF) recently, it's from a Dutch consultancy institution researching value of time, commissioned by the Dutch government. One of the tings they looked at is how people value their time on different cycling infrastructure. Value of time could be used as a proxy metric for safety/comfort on certain road types. They probably have the raw data if you contact them.

Screenshot_415

mncosta commented 5 months ago

Hi @EwoutH , thanks for your suggestions!

Typically, these notebooks are used in class, meaning that they are followed in order and code snippets are explained in detail during class, so that's why mainly there may not be that much detail and explanations all over the chapter. However, I see that adding these can be very helpful for anyone discovering the repo and following along at a distance. So I think your additions are very valuable, and we should keep them.

Overall, everything looks great, but there is a small error that needs fixing before we merge. When you look at the model's outputs, and specifically at the pseudo R^2:

explaining 38% of the variations in the choice outcomes, with values closer to 1 representing a perfect fit.

A Pseudo R2 of 0.38 doesn't actually mean we capture 38% of the variation in the choice outcomes. In that way, pseudo R2 cannot be really interpreted like R2 from a linear regression as it does not really capture the model's ability to predict outcomes, but rather is a way to compare models as we can analyze how much is learned vs a base model (such as a null model or ASC only model). You can take a look at Train, K. E. (2009). Discrete choice methods with simulation. Cambridge university press. and specifically Chapter 3.8.1. when the author talks about likelihood ratio tests.

In sum, I think you just change that small piece of text we can merge it.

temospena commented 5 months ago

Thank you @mncosta ! @EwoutH can you please make that change to this branch before I merge this PR? Thanks

temospena commented 4 months ago

Hi @EwoutH ! Any update regarding this minor suggestion? Let me know so I can proceed with the merge of this PR. Thanks

EwoutH commented 4 months ago

Thanks for the feedback and sorry for getting back so late. I made a change, does this describe it better/correctly?