本文整理匯總了Python中expWorkbench.ModelEnsemble.add_policies方法的典型用法代碼示例。如果您正苦於以下問題:Python ModelEnsemble.add_policies方法的具體用法?Python ModelEnsemble.add_policies怎麽用?Python ModelEnsemble.add_policies使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類expWorkbench.ModelEnsemble
的用法示例。
在下文中一共展示了ModelEnsemble.add_policies方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_tree
# 需要導入模塊: from expWorkbench import ModelEnsemble [as 別名]
# 或者: from expWorkbench.ModelEnsemble import add_policies [as 別名]
def test_tree():
log_to_stderr(level= INFO)
model = FluModel(r'..\..\models\flu', "fluCase")
ensemble = ModelEnsemble()
ensemble.parallel = True
ensemble.set_model_structure(model)
policies = [{'name': 'no policy',
'file': r'\FLUvensimV1basecase.vpm'},
{'name': 'static policy',
'file': r'\FLUvensimV1static.vpm'},
{'name': 'adaptive policy',
'file': r'\FLUvensimV1dynamic.vpm'}
]
ensemble.add_policies(policies)
results = ensemble.perform_experiments(10)
a_tree = tree(results, classify)
示例2: test_feature_selection
# 需要導入模塊: from expWorkbench import ModelEnsemble [as 別名]
# 或者: from expWorkbench.ModelEnsemble import add_policies [as 別名]
def test_feature_selection():
log_to_stderr(level= INFO)
model = FluModel(r'..\..\models\flu', "fluCase")
ensemble = ModelEnsemble()
ensemble.parallel = True
ensemble.set_model_structure(model)
policies = [{'name': 'no policy',
'file': r'\FLUvensimV1basecase.vpm'},
{'name': 'static policy',
'file': r'\FLUvensimV1static.vpm'},
{'name': 'adaptive policy',
'file': r'\FLUvensimV1dynamic.vpm'}
]
ensemble.add_policies(policies)
results = ensemble.perform_experiments(5000)
results = feature_selection(results, classify)
for entry in results:
print entry[0] +"\t" + str(entry[1])
示例3: model_init
# 需要導入模塊: from expWorkbench import ModelEnsemble [as 別名]
# 或者: from expWorkbench.ModelEnsemble import add_policies [as 別名]
def model_init(self, policy, kwargs):
'''initializes the model'''
try:
self.model_file = policy['file']
except KeyError:
ema_logging.warning("key 'file' not found in policy")
super(FluModel, self).model_init(policy, kwargs)
if __name__ == "__main__":
ema_logging.log_to_stderr(ema_logging.INFO)
model = FluModel(r'..\..\models\flu', "fluCase")
ensemble = ModelEnsemble()
ensemble.set_model_structure(model)
#add policies
policies = [{'name': 'no policy',
'file': r'\FLUvensimV1basecase.vpm'},
{'name': 'static policy',
'file': r'\FLUvensimV1static.vpm'},
{'name': 'adaptive policy',
'file': r'\FLUvensimV1dynamic.vpm'}
]
ensemble.add_policies(policies)
ensemble.parallel = True #turn on parallel processing
results = ensemble.perform_experiments(1000)
save_results(results, r'./data/1000 flu cases.bz2')