Skip to content

Commit

Permalink
PEP8 fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
jiffyclub committed Jun 16, 2014
1 parent 7fba60f commit 5dfe4b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
7 changes: 5 additions & 2 deletions urbansim/models/lcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,11 @@ def to_dict(self):
'model_expression': self.default_model_expr,
},
'fitted': self.fitted,
'models': {yamlio.to_scalar_safe(name): self._process_model_dict(m.to_dict())
for name, m in self._group.models.items()}
'models': {
yamlio.to_scalar_safe(name):
self._process_model_dict(m.to_dict())
for name, m in self._group.models.items()
}
}

def to_yaml(self, str_or_buffer=None):
Expand Down
15 changes: 10 additions & 5 deletions urbansim/models/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ class instance for use during prediction.
self.model_fit = fit
self.fit_parameters = _model_fit_to_table(fit)
if debug:
df = pd.DataFrame(fit.model.exog, columns=fit.model.exog_names, index=data.index)
df = pd.DataFrame(
fit.model.exog, columns=fit.model.exog_names, index=data.index)
df[fit.model.endog_names] = fit.model.endog
df["fittedvalues"] = fit.fittedvalues
df["residuals"] = fit.resid
Expand Down Expand Up @@ -592,7 +593,8 @@ class SegmentedRegressionModel(object):
"""
def __init__(
self, segmentation_col, fit_filters=None, predict_filters=None,
default_model_expr=None, default_ytransform=None, min_segment_size=0):
default_model_expr=None, default_ytransform=None,
min_segment_size=0):
self.segmentation_col = segmentation_col
self._group = RegressionModelGroup(segmentation_col)
self.fit_filters = fit_filters
Expand Down Expand Up @@ -703,7 +705,8 @@ def fit(self, data, debug=False):
value_counts = data[self.segmentation_col].value_counts()

for x in unique:
if x not in self._group.models and value_counts[x] > self.min_segment_size:
if x not in self._group.models and \
value_counts[x] > self.min_segment_size:
self.add_segment(x)

return self._group.fit(data, debug=debug)
Expand Down Expand Up @@ -781,8 +784,10 @@ def to_dict(self):
'ytransform': YTRANSFORM_MAPPING[self.default_ytransform]
},
'fitted': self.fitted,
'models': {yamlio.to_scalar_safe(name): self._process_model_dict(m.to_dict())
for name, m in self._group.models.items()}
'models': {
yamlio.to_scalar_safe(name):
self._process_model_dict(m.to_dict())
for name, m in self._group.models.items()}
}

def to_yaml(self, str_or_buffer=None):
Expand Down

0 comments on commit 5dfe4b7

Please sign in to comment.