import numpy as np

def ui_predict(ratings, similarity):
    all_user_mean = ratings.mean(axis = 1)
    ratings_diff = (ratings - all_user_mean[:, np.newaxis]) # (943, 1682)
    
    adjust = similarity.dot(ratings_diff)
    norm = np.array([np.abs(similarity).sum(axis=1)]).T

    pred = all_user_mean[:, np.newaxis] + adjust / norm
    
    return pred
def ii_predict(ratings, similarity):
    norm = np.array([np.abs(similarity).sum(axis=1)])
    pred = ratings.dot(similarity)  / norm
    return pred
8c8dc344a3f4b840c209a4dde8b10ebfa665ea2d
<mask token>

<mask token>


def ui_predict(ratings, similarity):
    all_user_mean = ratings.mean(axis=1)
    ratings_diff = ratings - all_user_mean[:, np.newaxis]
    adjust = similarity.dot(ratings_diff)
    norm = np.array([np.abs(similarity).sum(axis=1)]).T
    pred = all_user_mean[:, np.newaxis] + adjust / norm
    return pred


<mask token>

<mask token>


def ui_predict(ratings, similarity):
    all_user_mean = ratings.mean(axis=1)
    ratings_diff = ratings - all_user_mean[:, np.newaxis]
    adjust = similarity.dot(ratings_diff)
    norm = np.array([np.abs(similarity).sum(axis=1)]).T
    pred = all_user_mean[:, np.newaxis] + adjust / norm
    return pred


def ii_predict(ratings, similarity):
    norm = np.array([np.abs(similarity).sum(axis=1)])
    pred = ratings.dot(similarity) / norm
    return pred

import numpy as np


def ui_predict(ratings, similarity):
    all_user_mean = ratings.mean(axis=1)
    ratings_diff = ratings - all_user_mean[:, np.newaxis]
    adjust = similarity.dot(ratings_diff)
    norm = np.array([np.abs(similarity).sum(axis=1)]).T
    pred = all_user_mean[:, np.newaxis] + adjust / norm
    return pred


def ii_predict(ratings, similarity):
    norm = np.array([np.abs(similarity).sum(axis=1)])
    pred = ratings.dot(similarity) / norm
    return pred

import numpy as np

def ui_predict(ratings, similarity):
    all_user_mean = ratings.mean(axis = 1)
    ratings_diff = (ratings - all_user_mean[:, np.newaxis]) # (943, 1682)
    
    adjust = similarity.dot(ratings_diff)
    norm = np.array([np.abs(similarity).sum(axis=1)]).T

    pred = all_user_mean[:, np.newaxis] + adjust / norm
    
    return pred
def ii_predict(ratings, similarity):
    norm = np.array([np.abs(similarity).sum(axis=1)])
    pred = ratings.dot(similarity)  / norm
    return pred