コード例 #1
0
ファイル: test_cluster.py プロジェクト: adrivsh/EMAworkbench
"""
Created on Mar 15, 2012

.. codeauthor:: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl>
"""

from ema_workbench.analysis import clusterer
from ema_workbench.util import ema_logging

from ...em_framework import ModelEnsemble
from ..scarcity_example import ScarcityModel

if __name__ == "__main__":
    ema_logging.log_to_stderr(ema_logging.INFO)
    model = ScarcityModel(r"..\..\src\test", "fluCase")

    ensemble = ModelEnsemble()
    ensemble.set_model_structure(model)
    ensemble.parallel = True

    results = ensemble.perform_experiments(200)

    clusterer.cluster(
        data=results,
        outcome="relative market price",
        distance="gonenc",
        cMethod="maxclust",
        cValue=5,
        plotDendrogram=False,
    )
コード例 #2
0
ファイル: test_cluster.py プロジェクト: yjx4131/EMAworkbench
'''
Created on Mar 15, 2012

.. codeauthor:: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl>
'''

from ema_workbench.analysis import clusterer
from ema_workbench.util import ema_logging

from ..utilities import load_scarcity_data

if __name__ == "__main__":
    ema_logging.log_to_stderr(ema_logging.INFO)
    
    results = load_scarcity_data()
    
    clusterer.cluster(data=results, 
                      outcome='relative market price', 
                      distance='gonenc', 
                      cMethod='maxclust', 
                      cValue=5,
                      plotDendrogram=False)
コード例 #3
0
#load the data
data = load_results(r'..\examples\100 flu cases no policy.cPickle')

# specify the number of desired clusters
# note: the meaning of cValue is tied to the value for cMethod
cValue = 5

#perform cluster analysis
dist, clusteraloc, runlog, z = cluster(data=data, 
                                    outcome='deceased population region 1', 
                                    distance='gonenc', 
                                    interClusterDistance='complete', 
                                    cMethod = 'maxclust',
                                    cValue = cValue,
                                    plotDendrogram=False, 
                                    plotClusters=False, 
                                    groupPlot=False,
                                    sisterCount=100,
                                    tHoldCurvature = 0.1,
                                    tHoldSlope = 0.1
                                    )

#the plotting
fig = plt.figure()

#for each cluster
for i in range(1, cValue+1):
    #get the data
    values  = data[1]['deceased population region 1']
    values = values[clusteraloc==i]