def sampleInteractions(user_id,items_with_rating,n):
    if len(items_with_rating) > n:
        return user_id, random.sample(items_with_rating,n)
    else:
        return user_id, items_with_rating
For users with # interactions > n, replace their interaction history
dataset/ETHPy150Open evancasey/spark-knn-recommender/algorithms/itemBasedRecommender.py/sampleInteractions