本文整理汇总了Python中Analysis.median_high方法的典型用法代码示例。如果您正苦于以下问题:Python Analysis.median_high方法的具体用法?Python Analysis.median_high怎么用?Python Analysis.median_high使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analysis
的用法示例。
在下文中一共展示了Analysis.median_high方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Analysis [as 别名]
# 或者: from Analysis import median_high [as 别名]
def __init__(self, P, lstOfGenerationsNumbers):
outputPath = os.path.dirname(os.path.realpath(__file__)) + "/"
f = open(outputPath+"Stats.txt","w")
f.write(" ====================================================== \n")
f.write("|| ||\n")
f.write("|| Statistical Properties of this simulation run ||\n")
f.write("|| ||\n")
f.write(" ====================================================== \n\n\n")
f.write("Number of Agents : {:>5}\n".format(P.numberAgents))
f.write("Maximum size of social groups : {:>5}\n".format(P.maxSocSize))
f.write("Maximum number of Generations : {:>5}\n".format(P.generations))
f.write("Number of individual CultEvo runs: {:>5}\n\n\n\n".format(P.numberOfSimulationRuns))
f.write("Values:\n")
f.write("=======\n\n")
f.write("Averages and measures of central location\n")
f.write(".........................................\n\n")
f.write("mean : {:>6.2f}\n".format(stat.mean(lstOfGenerationsNumbers)))
f.write("median : {:>6.2f}\n".format(stat.median(lstOfGenerationsNumbers)))
f.write("mean_low : {:>6.2f}\n".format(stat.median_low(lstOfGenerationsNumbers)))
f.write("mean_high : {:>6.2f}\n".format(stat.median_high(lstOfGenerationsNumbers)))
f.write("mean_grouped: {:>6.2f}\n".format(stat.median_grouped(lstOfGenerationsNumbers)))
try:
f.write("mode : {:>6.2f}\n\n\n\n".format(stat.mode(lstOfGenerationsNumbers) ))
except :
f.write("mode : two equal values found\n")
f.write("Measures of spread\n")
f.write("..................\n\n")
f.write("Population standard deviation of data: {0:>6.2f}\n".format(stat.pstdev(lstOfGenerationsNumbers)))
f.write("Population variance of data : {0:>6.2f}\n".format(stat.pvariance(lstOfGenerationsNumbers)))
f.write("Sample standard deviation of data : {0:>6.2f}\n".format(stat.stdev(lstOfGenerationsNumbers)))
f.write("Sample variance of data : {0:>6.2f}\n".format(stat.variance(lstOfGenerationsNumbers)))
f.close()