algorithms/itemBasedRecommender.py
def sampleInteractions(user_id,items_with_rating,n):
    '''
    For users with # interactions > n, replace their interaction history
    with a sample of n items_with_rating
    '''
    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
    with a sample of n items_with_rating
    
For users with # interactions > n, replace their interaction history
with a sample of n items_with_rating
For users with # interactions > n replace their interaction history with a sample of n items_with_rating
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
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
with a sample of n items_with_rating
For users with # interactions > n replace their interaction history with a sample of n items_with_rating
'''
    For users with # interactions > n, replace their interaction history
    with a sample of n items_with_rating
    '''
user_id
items_with_rating
n