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


Python ModelEnsemble.add_model_structure方法代码示例

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


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

示例1: test_multiple_models

# 需要导入模块: from expWorkbench import ModelEnsemble [as 别名]
# 或者: from expWorkbench.ModelEnsemble import add_model_structure [as 别名]
def test_multiple_models():
    class Model1(ModelStructureInterface):
        uncertainties = [ParameterUncertainty((0,1),"a"),
                         ParameterUncertainty((0,1),"b")]
        
        outcomes = [Outcome("test")]
        
        def model_init(self, policy, kwargs):
            pass
        
        def run_model(self, case):
            self.output['test'] = 1

    class Model2(ModelStructureInterface):
        uncertainties = [ParameterUncertainty((0,1),"b"),
                         ParameterUncertainty((0,1),"c")]
        
        outcomes = [Outcome("test")]
        
        def model_init(self, policy, kwargs):
            pass
        
        def run_model(self, case):
            self.output['test'] = 1
    
#    os.remove('test.h5')

    nrOfExperiments = 10
    fileName = 'test.h5'
    experimentName = "one_exp_test"
    
    ensemble = ModelEnsemble()
    ensemble.add_model_structure(Model1('', "test1"))
    ensemble.add_model_structure(Model2('', "test2"))
    
    ensemble.perform_experiments(nrOfExperiments,
                                 callback=HDF5Callback,
                                 fileName=fileName,
                                 experimentName=experimentName)
开发者ID:,项目名称:,代码行数:41,代码来源:

示例2: PathOfWarModel

# 需要导入模块: from expWorkbench import ModelEnsemble [as 别名]
# 或者: from expWorkbench.ModelEnsemble import add_model_structure [as 别名]
                            "MPW-type-of-conflict",
                            "MPW",
                            "MPW-risk-averseness1",
                            "MPW-risk-averseness2",
                            "max-conflict-level",
                            "top-dog",
                            "time-since-MPW",
                            "expected-transition",
                            "Conflict-source",
                            "power-transition",
                            "conflict-time",
                            "war-time",
                            ])                    

if __name__ == '__main__':
    ema_logging.log_to_stderr(ema_logging.INFO)
    
    wd = r'./model'
    name = 'testmodel'
    msi = PathOfWarModel(wd, name) 
#     msi.run_length = 200
    ensemble = ModelEnsemble()
    ensemble.add_model_structure(msi)
    ensemble.parallel =  True
    
    nr_runs = 2
    results = ensemble.perform_experiments(nr_runs, reporting_interval=1)
    
    fn = r'./data/{} runs 10 replicaties 25 feb.tar.gz'.format(nr_runs)
    save_results(results, fn)  
开发者ID:rluteijn,项目名称:msc_thesis,代码行数:32,代码来源:Model_interface.py


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