Пример #1
0
def test_pearson_recommendations(_id, filtering):
    if filtering == 'user':
        ratings = read_ratings('ratingstest.csv')
        data = get_recommendations(ratings, _id, pearson_correlation)
    else:
        ratings = read_ratings('ratingstest.csv')
        item_based = read_item_based_data('pearsontest', pearson_correlation,
                                          ratings)
        data = get_recommended_items(ratings, item_based, _id)
    return jsonify(data)
Пример #2
0
def test_euclidean_recommendations(_id, filtering):
    if filtering == 'user':
        ratings = read_ratings('ratingstest.csv')
        data = get_recommendations(ratings, _id, euclidean_distance)
    else:
        ratings = read_ratings('ratingstest.csv')
        item_based = read_item_based_data('euclideantest', euclidean_distance,
                                          ratings)
        data = get_recommended_items(ratings, item_based, _id)
    return jsonify(data)
Пример #3
0
def user_matches(_id):
    """USER MATCHES"""

    data = top_matches(read_ratings('ratings.csv'), _id, 100,
                       pearson_correlation)
    return jsonify(data)
Пример #4
0
def get_users_ratings():
    """USERS RATINGS"""

    return jsonify(read_ratings('ratings.csv'))