Beispiel #1
0
 def test_estimation(self):
     for model_name in ['residential_building_type_choice_model', 
                        'tenure_choice_model', 
                        'work_at_home_choice_model',
                        'workplace_choice_model_for_resident',
                        'auto_ownership_choice_model',
                        'hbw_mode_choice_model',
                        'real_estate_price_model',
                        'household_location_choice_model',
                        'shopping_destination_choice_model',
                        ('employment_location_choice_model', 'home_based'),
                        ('employment_location_choice_model', 'non_home_based')
                        ]:
         if type(model_name)==tuple:
             model_name, group_member = model_name
         else:
             group_member = None        
             
         estimator = EstimationRunner(model=model_name,  
                                      model_group=group_member,
                                      xml_configuration=self.xml_config,
                                      configuration = None
                                      )
         estimator.estimate()
    'repm': [
        'real_estate_price_model',
        'sanfrancisco.estimation.repm_specification', None
    ],
    "BLDGLCM-nonres": [
        "building_location_choice_model",
        'sanfrancisco.estimation.bldglcm_specification', "nonresidential"
    ],
    "BLDGLCM-res": [
        "building_location_choice_model",
        'sanfrancisco.estimation.bldglcm_specification', "residential"
    ],
}

if __name__ == '__main__':
    #    model = 'repm'
    #    model = 'hlcm'
    #    model = 'blcm'
    #    model = "BLDGLCM-nonres"
    model = "BLDGLCM-res"

    config = Baseline()
    config.merge(my_configuration)
    config['config_changes_for_estimation'] = ConfigChangesForEstimation()
    er = EstimationRunner(models[model][0],
                          specification_module=models[model][1],
                          model_group=models[model][2],
                          configuration=config,
                          save_estimation_results=True)
    er.estimate()
     import wingdbstub
 except:
     pass
 option_group = EstimationOptionGroup()
 parser = option_group.parser
 (options, args) = parser.parse_args()
 if options.model_name is None:
     raise StandardError, "Model name (argument -m) must be given."
 if (options.configuration_path is None) and (options.xml_configuration is
                                              None):
     raise StandardError, "Configuration path (argument -c) or XML configuration (argument -x) must be given."
 if (options.specification is None) and (options.xml_configuration is None):
     logger.log_warning(
         "No specification given (arguments -s or -x). Specification taken from the cache."
     )
 if options.xml_configuration is not None:
     xconfig = XMLConfiguration(options.xml_configuration)
 else:
     xconfig = None
 if options.configuration_path is None:
     config = None
 else:
     config = get_config_from_opus_path(options.configuration_path)
 estimator = EstimationRunner(model=options.model_name,
                              specification_module=options.specification,
                              xml_configuration=xconfig,
                              model_group=options.model_group,
                              configuration=config,
                              save_estimation_results=options.save_results)
 estimator.estimate()
 er = estimator