def ochiaiList(dirPosition): answerList = calculatorPublic.getAnswer(dirPosition) gcovList = calculatorPublic.getGcov(dirPosition, 1).T ef = calculatorPublic.getEF(gcovList, answerList) ep = calculatorPublic.getEP(gcovList, answerList) nf = calculatorPublic.getNF(gcovList, answerList) return ef / numpy.sqrt((ef + nf) * (ef + ep))
def jaccardList(dirPosition): answerList = calculatorPublic.getAnswer(dirPosition) gcovList = calculatorPublic.getGcov(dirPosition, 1).T ef = calculatorPublic.getEF(gcovList, answerList) ep = calculatorPublic.getEP(gcovList, answerList) nf = calculatorPublic.getNF(gcovList, answerList) return 1 / (1 + (ep + nf) / ef)
def tarantulaList(dirPosition): answerList = calculatorPublic.getAnswer(dirPosition) gcovList = calculatorPublic.getGcov(dirPosition, 1).T ef = calculatorPublic.getEF(gcovList, answerList) ep = calculatorPublic.getEP(gcovList, answerList) tf = calculatorPublic.getTF(answerList) tp = calculatorPublic.getTP(answerList, tf) return 1 / (1 + (numpy.dot(ep, tf)) / (numpy.dot(ef, tp)))
def tarantula(dirPosition, testsList): # 载入源数据中的测试结果 answerList = calculatorPublic.getAnswer(dirPosition) # 载入源数据中的gcov图谱集 gcovList = calculatorPublic.getGcov(dirPosition, 1) # 存放本次计算需要的测试结果集 answer = [] # 存放本次计算需要的gcov图谱集 gcov = [] # 获取对应于testsList中所包含的测试用例的测试结果 for test in testsList: answer.append(answerList[test]) gcov.append(gcovList[test]) # 将answer和gcov两个list都转换为numpy矩阵类型 answer = numpy.array(answer) gcov = numpy.array(gcov) # 对gcov进行翻转 gcov = gcov.T ef = calculatorPublic.getEF(gcov, answer) ep = calculatorPublic.getEP(gcov, answer) tf = calculatorPublic.getTF(answer) tp = calculatorPublic.getTP(answer, tf) return 1 / (1 + (numpy.dot(ep, tf)) / (numpy.dot(ef, tp)))