synthicity/urbansim — pull request #20 by jiffyclub (2014-05-14 17:32:25+00:00)
Title: YAML Saving and Loading

With this `RegressionModel` and `MNLLocationChoiceModel` can have their configuration saved to YAML files using `.to_yaml` methods. Saved configurations can be used to instantiate models using `.from_yaml` methods. Matching methods for the other model classes will come soon (where applicable).

Another change here is some flexibility in how model expressions can be specified for regressions and location choice models. Previously these had to be strings compatible with patsy, and that's still fine, but now lists and dictionaries can be used. The following are valid and equivalent model expressions:

```python
model_expression = 'np.log(x) ~ x + np.log1p(y)'

model_expression = {'left_side': 'np.log(x)',
'right_side': ['x', 'np.log1p(y)']}
```

And for right-side only expressions these are all equivalent and valid:

```python
model_expression = 'x + np.log1p(y) + I(z < 1)'

model_expression = ['x', 'np.log1p(y)', 'I(z < 1)']

model_expression = {'right_side': ['x', 'np.log1p(y)', 'I(z < 1)']}
```