Skip to content

Commit

Permalink
working towards getting rid of yamlmodelrunner
Browse files Browse the repository at this point in the history
  • Loading branch information
fscottfoti committed Jul 29, 2014
1 parent 907dcb6 commit f6f9bbf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions urbansim/models/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ..exceptions import ModelEvaluationError
from ..utils import yamlio
from ..utils.logutil import log_start_finish
from ..utils import misc

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -465,6 +466,24 @@ def columns_used(self):
util.columns_in_filters(self.predict_filters),
util.columns_in_formula(self.model_expression))))

@classmethod
def run_fit_from_cfg(self, df, cfgname):
"""
Parameters
----------
df : DataFrame
The dataframe which contains the columns to use for the estimation.
cfgname : string
The name of the yaml config file which describes the hedonic model.
"""
print "Running hedonic estimation\n"
hm = self.from_yaml(str_or_buffer=cfg)
df = df[hm.columns_used()]
print hm.fit(df, debug=True).summary()
est_data = {"est_data": hm.est_data}
hm.to_yaml(str_or_buffer=cfg)
return est_data


class RegressionModelGroup(object):
"""
Expand Down

0 comments on commit f6f9bbf

Please sign in to comment.