Esempio n. 1
0
def getevaluate(weights):

    APISrcfileScores_dict = getAPISrcfileScores.main(weights[:2])#weights:自然语言  与程序语言之间的权重关系,决定相似度分数
    Result_dict = getRecmdAPI_result.getFinal_Result(APIdscpScors_dict , APISimilarReportsScores_dict , APISrcfileScores_dict , weights[2:])

    Aimresult=getAimList()
    MAP = evaluate.main(Aimresult,Result_dict)
    return MAP
def main(issue):
    weights = [
        0.63000000000000012, 0.28000000000000019, 0.10000000000000012, 1.0,
        0.80000000000000004
    ]

    APISimilarReportsScores_dict = getSimilarityScores2Reports.main_API(issue)
    APIdscpScors_dict = getAPIdscpScors.main(issue)
    APISrcfileScores_dict = getAPISrcfileScores.main(
        weights[:2], issue)  #weights:自然语言  与程序语言之间的权重关系,决定相似度分数
    Final_Result = getFinal_Result(APIdscpScors_dict,
                                   APISimilarReportsScores_dict,
                                   APISrcfileScores_dict, weights[2:])
    #write_NoResult(Final_Result)
    return Final_Result[issue.Issuekey]
Esempio n. 3
0
    workbook = xlrd.open_workbook(r'Input/Hadoop_issuekeys_UsedAPI.xls')
    sheet = workbook.sheet_by_name('sheet1')
    Aimresult={}
    for j in range(1,sheet.nrows):
        issuekey=sheet.cell(j,0).value
        if sheet.cell(j,1).value=='':
            Aimresult[issuekey] = []
        else:
            Aimresult[issuekey] = sheet.cell(j,1).value.split(';')
    return Aimresult

weights = [1,1,  1,1,1]#前两个用于Src相似度计算时,后三个用于  API 推荐结果的汇总
APISimilarReportsScores_dict  = getSimilarityScores2Reports.main_API()
print '5'
APIdscpScors_dict = getAPIdscpScors.main()
APISrcfileScores_dict = getAPISrcfileScores.main(weights[:2])#weights:自然语言  与程序语言之间的权重关系,决定相似度分数
    

solutionnow =weights 
valuenow = getevaluate(solutionnow)#目标函数解
print valuenow

best = 0.0
for count in range(6):
#for index in [1] + range(3,9) + range(10,17):
    #for index in range(len(solutionnow)):
    for index in [2,3,4]:
        i=1.0
        best_i = solutionnow[index]
        while i>0.05: 
            solutionnow[index] = i