text_html_output_1.png
import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import surprise

import surprise  #Scikit-Learn library for recommender systems.

raw = pd.read_csv('../input/ratings.csv')

raw.drop_duplicates(inplace=True)

raw = raw[['user_id', 'book_id', 'rating']]
reader = surprise.Reader(rating_scale=(1, 5))
data = surprise.Dataset.load_from_df(raw, reader)

Alg1 = ProbabilisticMatrixFactorization(learning_rate=0.05, num_epochs=4, num_factors=10)
data1 = data.build_full_trainset()
Alg1.fit(data1)
print(raw.user_id.iloc[4], raw.book_id.iloc[4])
Alg1.estimate(raw.user_id.iloc[4], raw.book_id.iloc[4])