Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UrbanSim using outdated version of Patsy #169

Closed
apdjustino opened this issue Jul 12, 2016 · 5 comments
Closed

UrbanSim using outdated version of Patsy #169

apdjustino opened this issue Jul 12, 2016 · 5 comments

Comments

@apdjustino
Copy link

I discovered this error while trying to fit a SegmentedMNLDiscreteChoiceModel. Patsy throws an error when creating the dmatrix. Looking into it I found that the author of Patsy fixed this when upgrading Patsy from v.0.4.0 to v0.4.1

I upgraded Patsy and this corrected the error. I don't know if the latest UrbanSim release bundles Patsy 0.4.1, but it will need the newer version of the package to fit models.

@pksohn
Copy link
Contributor

pksohn commented Apr 13, 2017

@apdjustino I know it's been a while, but do you remember if the segmented MNL model was indeed breaking on v0.4.0, or were you maybe on an earlier version? I'm able to reproduce this error on Patsy v0.2.1 (which urbansim currently requires, so it's clear we need to bump the required version), but for me the issue is resolved upon upgrading to v0.3.0.

@pksohn
Copy link
Contributor

pksohn commented May 5, 2017

We're going to update the Patsy required version to 0.3.0 in this release. Give us a heads up if you still think we need to require a higher version.

@pksohn
Copy link
Contributor

pksohn commented May 9, 2017

Addressed with #195.

@pksohn pksohn closed this as completed May 9, 2017
@pksohn
Copy link
Contributor

pksohn commented May 16, 2017

Reopening this as @sablanchard found a similar bug.

We should likely bump required version of Patsy all the way up to 0.4.1 to ensure the bugfix is included, as @apdjustino suggested.

There are 697875 total available units
    and 118807 total choosers
    but there are 0 overfull buildings
    for a total of 580244 temporarily empty units
    in 10410 buildings total in the region
There are 1176 total movers for this LCM
Traceback (most recent call last):
  File "simulate.py", line 172, in <module>
    run()
  File "simulate.py", line 94, in run
    orca.run(datasources.step_sequence(), iter_vars = range(2011, forecast_year + 1))
  File "C:\Users\Sam\Anaconda2\lib\site-packages\orca\orca.py", line 1987, in run
    step()
  File "C:\Users\Sam\Anaconda2\lib\site-packages\orca\orca.py", line 792, in __call__
    return self._func(**kwargs)
  File "C:\Users\Sam\Dropbox\Work\github_projects\block_model\block_model\models.py", line 1145, in func
    remaining_capacity_attrib)
  File "C:\Users\Sam\Dropbox\Work\github_projects\block_model\block_model\utils.py", line 352, in lcm_simulate
    new_units, _ = yaml_to_class(cfg).predict_from_cfg(movers, units, cfgname=cfg, alternative_ratio=alternative_ratio)
  File "c:\repos\ual\urbansim\urbansim\models\dcm.py", line 830, in predict_from_cfg
    new_units = lcm.predict(choosers, alternatives, debug=debug)
  File "c:\repos\ual\urbansim\urbansim\models\dcm.py", line 635, in predict
    choosers, alternatives, filter_tables=False)
  File "c:\repos\ual\urbansim\urbansim\models\dcm.py", line 524, in probabilities
    self.str_model_expression, data=merged, return_type='dataframe')
  File "C:\Users\Sam\Anaconda2\lib\site-packages\patsy\highlevel.py", line 278, in dmatrix
    NA_action, return_type)
  File "C:\Users\Sam\Anaconda2\lib\site-packages\patsy\highlevel.py", line 152, in _do_highlevel_design
    NA_action)
  File "C:\Users\Sam\Anaconda2\lib\site-packages\patsy\highlevel.py", line 57, in _try_incr_builders
    NA_action)
  File "C:\Users\Sam\Anaconda2\lib\site-packages\patsy\build.py", line 706, in design_matrix_builders
    categories=None)
  File "C:\Users\Sam\Anaconda2\lib\site-packages\patsy\design_info.py", line 88, in __init__
    raise ValueError("For numerical factors, num_columns "
ValueError: For numerical factors, num_columns must be an int
Closing remaining open files:.\data\model_data.h5...done

@smmaurer
Copy link
Member

smmaurer commented May 1, 2020

Resolved in PR #225.

@smmaurer smmaurer closed this as completed May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants