コード例 #1
0
 def profileSimulateGraphMatch(self): 
     N, matchAlpha, breakDist, purtScale = HIVModelUtils.toyABCParams()
     startDate, endDate, recordStep, M, targetGraph = HIVModelUtils.toySimulationParams()
     theta, stdTheta = HIVModelUtils.toyTheta()
 
     featureInds= numpy.ones(targetGraph.vlist.getNumFeatures(), numpy.bool)
     featureInds[HIVVertices.dobIndex] = False 
     featureInds[HIVVertices.infectionTimeIndex] = False 
     featureInds[HIVVertices.hiddenDegreeIndex] = False 
     featureInds[HIVVertices.stateIndex] = False 
     featureInds = numpy.arange(featureInds.shape[0])[featureInds]        
     
     #QCV is fastest and most accurate 
     #PATH is slowests but quite accurate 
     #RANK is very fast by less accurate than PATH 
     #U is fastest but least accurate         
     
     matcher = GraphMatch("QCV", alpha=matchAlpha, featureInds=featureInds, useWeightM=False)
     matcher.lambdaM = 50 
     matcher.init = "rand"
     graphMetrics = HIVGraphMetrics2(targetGraph, breakDist, matcher, float(endDate))        
     
     def run(): 
         times, infectedIndices, removedIndices, graph = HIVModelUtils.simulate(theta, startDate, endDate, recordStep, M, graphMetrics)
         print("Mean distance " + str(graphMetrics.meanDistance()))
     
     ProfileUtils.profile('run()', globals(), locals())