我无法显示所有对迭代(例如:查询参数:321,212,341)
[321][212] = 0.564
[321][341] = 0.26
[212][341] = 0.22
而且我不确定这是否与 for 循环有关:
sim_pairs = []
match_pair = {}
for i in range(len(matID) - 1):
for j in range(i+1, len(matID) - 1):
mat1 = int(matID[i])
mat2 = int(matID[i + 1])
compute_similarity = similarity_material(mat1, mat2, method='matching')
s = compute_similarity
current_item, next_item = matID[i], matID[i + 1]
sim_pairs.append((current_item, next_item, s))
sim_pairs = sorted(sim_pairs, key=(lambda x: x[1]), reverse=True)
return return_object(sim_pairs)
如果有人可以帮助我理解为什么配对/计算不会显示会有所帮助,谢谢。