Slide 24
Slide 24 text
user_basis_array = init_array(users_count)
item_basis_array = init_array(items_count)
user_p_array = init_2d_array(users_count, factors)
item_q_array = init_2d_array(items_count, factors)
rate = 0.01
regularization = 0.1
mean_score = 7
def get_predict(row, col):
predict_score_basis = mean_score + item_basis_array[row] + user_basis_array[col]
svd_predict = dot(item_q_array[row], user_p_array[col])
return predict_score_basis + svd_predict
def get_error(row, col, real_score):
predict_score = get_predict(row, col)
return real_score - predict_score
data = []
columns = []
rows = []