human
I am working on the file "Kaggle-Expedia/Expedia Hotel Recommendations.ipynb".
The first task is:
Combining predictions
Combine exact_matches, preds, and most_common_clusters.
Can you write Python code for it?
 Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.

def f5(seq, idfun=None):
    """Uniquify a list by Peter Bengtsson
    https://www.peterbe.com/plog/uniqifiers-benchmark
    """
    if idfun is None:
        def idfun(x):
            return x

    seen = {}
    result = []
    for item in seq:
        marker = idfun(item)
        if marker in seen:
            continue
        seen[marker] = 1
        result.append(item)
    return result

full_preds = [
    f5(exact_matches[p] + preds[p] + most_common_clusters)[:5]
    for p
    in range(len(preds))
]
metrics.mapk([[l] for l in t2["hotel_cluster"]], full_preds, k=5)