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

This is the set up updates to finish moving urbansim to the new simulation framework #67

Merged
merged 31 commits into from
Jul 30, 2014

Conversation

fscottfoti
Copy link
Contributor

No description provided.

yamlmodelrunner needs to be moved and import time at the top
marking agents to relocate with np.nan is a big performance issue.  I think this forces the type to float and then calling .loc with a float is a major performance issue.  Moving this back to marking relocating agents with -1 fixes the problem for now.  This might need a more permanent fix.

Also there was a warning in sqftproforma that needed to be addressed
need to remove nans before sampling

-1 now marks relocating agents
@fscottfoti
Copy link
Contributor Author

This branch probably can't be merged until we converge on the best way to do the yamlmodelrunner and then update the client repos

@@ -325,6 +332,7 @@ class instance for use during prediction.
self.fit_parameters = _model_fit_to_table(fit)
if debug:
index = util.apply_filter_query(data, self.fit_filters).index
assert len(fit.model.exog) == len(index)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a helpful message to this so someone knows what's wrong if this happens. The syntax is assert expr, 'message'.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.48%) when pulling 7f3a03f on new-simulation-testing into 04a73d4 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.51%) when pulling d164f27 on new-simulation-testing into 04a73d4 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.55%) when pulling d7dbb95 on new-simulation-testing into ec95b55 on master.

Conflicts:
	urbansim/sim/simulation.py
@coveralls
Copy link

Coverage Status

Coverage increased (+1.53%) when pulling ebb7b7c on new-simulation-testing into 2f11343 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.29%) when pulling f6f9bbf on new-simulation-testing into 6907bb6 on master.

@@ -325,6 +333,8 @@ class instance for use during prediction.
self.fit_parameters = _model_fit_to_table(fit)
if debug:
index = util.apply_filter_query(data, self.fit_filters).index
assert len(fit.model.exog) == len(index), "The estimate data is"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll need to format this line like this:

assert len(fit.model.exog) == len(index), (
    'The estimate data is unequal in length to '
    'the original dataframe, usually caused by nans')

As is I think the second line of the message will be ignored.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.54%) when pulling f9ce17c on new-simulation-testing into 6907bb6 on master.

and the test needed to account for this.  I think this is the desired behavior since the segmentation column needs to be added to the dataframe
@coveralls
Copy link

Coverage Status

Coverage increased (+5.15%) when pulling b21ebd1 on new-simulation-testing into f6a4157 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.39%) when pulling 2c35710 on new-simulation-testing into f6a4157 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.94%) when pulling ca34f90 on new-simulation-testing into f6a4157 on master.

@fscottfoti
Copy link
Contributor Author

@jiffyclub I think this pull request is pretty close to ready to be merged - can you take a look? The Bay Area model no longer uses dataset.py or yamlmodelrunner.py but they're still there until semcog gets switched over. Let me know if you see any issues.

if len(locations) > len(movers) * location_ratio:
print("Location ratio exceeded: %d locations and only %d choosers" %
(len(locations), len(movers)))
idxes = random.choice(locations.index, size=len(movers) * location_ratio,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numpy is already imported, you can use np.random here and remove the import up top.

@jiffyclub
Copy link
Member

In lcm.py and regression.py it'd be good to have some logging statements along the lines of logging.debug('fitting regression model from file {}'.format(cfgname)) so we have some context of what initiated things.

There are also a lot of print statements that don't have context. If those are providing essential info to users they are fine, but there should be context before printing a dataframe description or fit results.


new_units = lcm.predict(movers, locations, debug=True)
print("Assigned %d choosers to new units" % len(new_units.index))
return new_units
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I fixed the hardwired debug. What do you think about returning lcm, new_units from the prediction function?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me, just document it. Any function/method that returns something should have that documented in a Returns section as described here: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#sections.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.13%) when pulling 32ca53d on new-simulation-testing into b297685 on master.

fscottfoti added a commit that referenced this pull request Jul 30, 2014
This is the set up updates to finish moving urbansim to the new simulation framework.
@fscottfoti fscottfoti merged commit c28b411 into master Jul 30, 2014
@fscottfoti
Copy link
Contributor Author

Hopefully I got all of the updates @jiffyclub suggested - if I didn't let me know.

@fscottfoti fscottfoti deleted the new-simulation-testing branch July 30, 2014 23:08
@jiffyclub
Copy link
Member

Looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants