urbansim
urbansim copied to clipboard
Report number of records in estimation
It would be very useful if the dcm estimation class reports how many records were used in the estimation. Especially in segmented choice models, when the segments might be smaller than estimation_sample_size, it would be extremely helpful to have that info.
It could go into the report_fit method. I would create a pull request but I don't know where the sample size is stored.
This is something I've wanted as well. I don't think the number of observations is stored currently, but we could modify urbanchoice.mnl_estimate()
to retain it:
https://github.com/UDST/urbansim/blob/master/urbansim/urbanchoice/mnl.py#L175-L268
Going farther, it would be nice to have a full summary table, like we get from StatsModels for OLS. I looked into this last year and set up a prototype in the ChoiceModels codebase. Here's the code and here's what it looks like (cell 13 near the bottom).
So a solution is definitely coming when we update UrbanSim to use the ChoiceModels estimation codebase later this year, but it should also be feasible to add reporting of the observation count as a quick fix. Maybe in conjunction with #208?
We now have code in ChoiceModels to generate a full summary table for MNL estimation: https://github.com/UDST/choicemodels/pull/31
We should be able to bring this over to the current version of UrbanSim without too much surgery.
Great - thanks Sam!