当前位置: 首页>>代码示例>>Python>>正文


Python RegressionModel.prepare_for_run方法代码示例

本文整理汇总了Python中opus_core.regression_model.RegressionModel.prepare_for_run方法的典型用法代码示例。如果您正苦于以下问题:Python RegressionModel.prepare_for_run方法的具体用法?Python RegressionModel.prepare_for_run怎么用?Python RegressionModel.prepare_for_run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在opus_core.regression_model.RegressionModel的用法示例。


在下文中一共展示了RegressionModel.prepare_for_run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: prepare_for_run

# 需要导入模块: from opus_core.regression_model import RegressionModel [as 别名]
# 或者: from opus_core.regression_model.RegressionModel import prepare_for_run [as 别名]
    def prepare_for_run(self, add_member_prefix=True, specification_storage=None, specification_table=None, coefficients_storage=None,
                         coefficients_table=None, **kwargs):
        if add_member_prefix:
            specification_table, coefficients_table = \
                self.group_member.add_member_prefix_to_table_names([specification_table, coefficients_table])

        return RegressionModel.prepare_for_run(self, specification_storage=specification_storage, specification_table=specification_table, 
                                               coefficients_storage=coefficients_storage, coefficients_table=coefficients_table, **kwargs)
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:10,代码来源:regression_model_member.py

示例2: prepare_for_run

# 需要导入模块: from opus_core.regression_model import RegressionModel [as 别名]
# 或者: from opus_core.regression_model.RegressionModel import prepare_for_run [as 别名]
    def prepare_for_run(self, dataset_pool, 
                        create_proposal_set=True,
                        parcel_filter_for_new_development=None, 
                        parcel_filter_for_redevelopment=None, 
                        template_filter=None,
                        spec_replace_module_variable_pair=None,
                        proposed_units_variable="urbansim_parcel.development_project_proposal.units_proposed",
                        **kwargs):
        """create development project proposal dataset from parcels and development templates.
        spec_replace_module_variable_pair is a tuple with two elements: module name, variable within the module
        that contans a dictionary of model variables to be replaced in the specification.
        """
        specification, coefficients, dummy = RegressionModel.prepare_for_run(self, **kwargs)
        try:
            existing_proposal_set_parent = dataset_pool.get_dataset('development_project_proposal')
            #load proposals whose status_id are not of id_tentative or id_not_available
            available_idx = where(logical_and(existing_proposal_set_parent.get_attribute("status_id") != DevelopmentProjectProposalDataset.id_tentative,
                                              existing_proposal_set_parent.get_attribute("status_id") != DevelopmentProjectProposalDataset.id_not_available))[0]
            existing_proposal_set = DatasetSubset(existing_proposal_set_parent, available_idx)
            # Code updated by Hanyi Li, MAG 6/8/2010
            # Replacing the cached 'development_project_proposal' dataset with
            # the filtered dataset 'existing_proposal_set'
            dataset_pool.replace_dataset(existing_proposal_set_parent.get_dataset_name(), existing_proposal_set)
        except:
            existing_proposal_set = None
        
        parcels = dataset_pool.get_dataset('parcel')
        templates = dataset_pool.get_dataset('development_template')

        # It is important that during this method no variable flushing happens, since
        # we create datasets of the same name for different purposes (new development and redevelopment)
        # and flushing would mix them up
        flush_variables_current = SessionConfiguration().get('flush_variables', False)
        SessionConfiguration().put_data({'flush_variables': False})
        
        # Code added by Jesse Ayers, MAG, 9/14/2009
        # Getting an index of parcels that have actively developing projects (those on a velocity function)
        # and making sure that new proposals are not generated for them
        if existing_proposal_set:
            parcels_with_proposals = existing_proposal_set.get_attribute('parcel_id')
            parcels_with_proposals_idx = parcels.get_id_index(parcels_with_proposals)
            if parcel_filter_for_new_development is not None:
                if parcel_filter_for_new_development[parcel_filter_for_new_development.find('=')+1] == '=':
                    filter = 'flter = numpy.logical_and(parcel.number_of_agents(development_project_proposal) == 0, %s)' % parcel_filter_for_new_development
                else:
                    parcel_filter_for_new_development = parcel_filter_for_new_development[parcel_filter_for_new_development.find('=')+1:].lstrip()
                    filter = 'flter = numpy.logical_and(parcel.number_of_agents(development_project_proposal) == 0, %s)' % parcel_filter_for_new_development
                index1 = where(parcels.compute_variables(filter))[0]

        else:
            if parcel_filter_for_new_development is not None:
                index1 = where(parcels.compute_variables(parcel_filter_for_new_development))[0]
            else:
                index1 = None
            
        if template_filter is not None:
            try:
                index2 = where(templates.compute_variables(template_filter))[0]
            except Exception, e:
                logger.log_warning( "template_filter is set to %s, but there is an error when computing it: %s"
                                   % (template_filter, e) )
                index2 = None
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:64,代码来源:development_project_proposal_regression_model.py

示例3: prepare_for_run

# 需要导入模块: from opus_core.regression_model import RegressionModel [as 别名]
# 或者: from opus_core.regression_model.RegressionModel import prepare_for_run [as 别名]
 def prepare_for_run(self, *args, **kwargs):
     spec, coef, dummy = RegressionModel.prepare_for_run(self, *args, **kwargs)
     return (spec, coef)
开发者ID:psrc,项目名称:urbansim,代码行数:5,代码来源:land_price_model.py


注:本文中的opus_core.regression_model.RegressionModel.prepare_for_run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。