本文整理汇总了Python中Analyzer.Analyzer.functionMatches方法的典型用法代码示例。如果您正苦于以下问题:Python Analyzer.functionMatches方法的具体用法?Python Analyzer.functionMatches怎么用?Python Analyzer.functionMatches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analyzer.Analyzer
的用法示例。
在下文中一共展示了Analyzer.functionMatches方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Analyzer
# 需要导入模块: from Analyzer import Analyzer [as 别名]
# 或者: from Analyzer.Analyzer import functionMatches [as 别名]
parser = argparse.ArgumentParser(description="Analyze Multi-Objective Optimization algorithm results against true Pareto fronts")
parser.add_argument("--name", "-n", help="name of the selected results")
parser.add_argument("--results", "-r", metavar="RESULT", nargs="+", help="results directory of an algorithm")
parser.add_argument("--functions", "-f", metavar="FUNCTION", nargs="*", help="function to test")
parser.add_argument("--pareto", "-p", help="true Pareto front directory")
args = parser.parse_args()
analyzer = Analyzer()
analyzer.setResultDirectories(args.results)
pareto = args.pareto
if pareto is None:
pareto = os.path.dirname(__file__) + "/../resources/" + Analyzer.__PARETO__
analyzer.setPareto(pareto)
functions = []
for functionName in analyzer.getFunctionNames():
if len(args.functions) == 0 or True in [analyzer.functionMatches(fn, functionName) for fn in args.functions]:
functions.append(functionName.upper())
functions.sort()
resultDir = args.name
if resultDir[-1] == "/":
resultDir = resultDir[:-1];
if os.path.exists(resultDir):
newResultDir = "%s-%s" % (resultDir, time.strftime("%Y%m%d-%H%M%S"))
print "Backing up previous selection at '%s' to '%s'" % (resultDir, newResultDir)
shutil.move(resultDir, newResultDir)
os.mkdir(resultDir)
for functionName in functions:
print "Selecting best result for %s" % functionName
analyzer.computeMetrics(functionName)