choicemodels
choicemodels copied to clipboard
Refactor MNL estimation
It would be nice to refactor the MNL estimation code, which was originally brought over from urbansim.urbanchoice.mnl
. It's been updated in places to provide additional estimation metrics and resolve deprecation warnings, but is mostly unchanged.
The code seems fast and reliable, but it's hard to use, hard to update, and appears to include some partial or extraneous functionality that would be nice to either remove or document and test (e.g. GPU acceleration, estimation weights, latent classes).
Roughly, the pieces are:
1. Probability calculation (mnl_probs
)
Already refactored in MultinomialLogitResults.probabilities()
, but that version may need to be adapted to accept numpy arrays instead of dataframes for faster iteration in the estimation stage.
2. Likelihood calculation (mnl_loglik
)
Hardest part -- can be cleaned up similarly, with dependencies on the PMAT utility removed.
3. Orchestration of maximum likelihood estimation (mnl_estimate
)
Pretty straightforward.
4. Calculation of estimation metrics (mnl_estimate
)
Pretty straightforward.
5. Simulation (mnl_simulate
)
Already refactored; now fully replaced by choicemodels.tools.simulation
.
May want to look at issue #53 first, in case we can avoid maintaining an estimation codebase entirely.