當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。