UDST / choicemodels

Python library for discrete choice modeling
https://udst.github.io/choicemodels
BSD 3-Clause "New" or "Revised" License
74 stars 33 forks source link

Comparison of native estimation code with PyLogit #53

Open smmaurer opened 5 years ago

smmaurer commented 5 years ago

PyLogit estimation for MNL is more flexible than the native ChoiceModels implementation (originally brought over from urbansim.urbanchoice.mnl), but much slower. See initial experiments here: Destination-choice-models-02.ipynb

What's causing the performance gap? If it would be easy to fix in PyLogit, then we wouldn't need to maintain a separate estimation codebase.

timothyb0912 commented 5 years ago

Let me know what you find as the root cause of the slowness or what you're considering changing!

Also, feel free to open up a pull request! I'm happy to accept any changes that increase estimation speed while not breaking tests. =)

I imagine some of the slowness comes from:

  1. The current version of PyLogit on PyPI using a slow routine for calculating the hessian at the end of the estimation process.
  2. PyLogit not taking advantage of the specific data structures that I think UrbanSim most commonly uses: MNL with generic alternatives.
  3. PyLogit using a single codebase for the estimation of MNL as well as more general asymmetric "logit-type" choice models.