def METHOD_NAME(preds, labels, guids):
    ndcgs = []
    query2content = {}
    for guid, pred, label in zip(guids, preds, labels):
        query = guid.split("_")[0]
        if not query in query2content:
            query2content[query] = [[int(pred)], [int(label)]]
        else:
            query2content[query][0].append(int(pred))     
            query2content[query][1].append(int(label))     
    for key in query2content.keys():
        if len(query2content[key][1]) < 2 or len(query2content[key][0]) < 2:
            continue 
        ndcgs.append(ndcg_score(np.asarray([query2content[key][1]]), np.asarray([query2content[key][0]])))
    return {"ndcg" : np.array(ndcgs).mean()}