matplotlib.pyplot.gcf().clear() print("------------------Baseline Predictor Testing Complete------------------") print("----------------User User Collaborative Filtering Testing--------------") model = UserUserCollaborativeFiltering() model.train(X, Y) space = (numpy.linspace(1, 2000, 100)).astype(int) scores = [] times = [] for k in space: print("Epoch: %i", k) model.set_neighbourhood(k) if k > 1: start_time = time.time() score = model.RMSE(X_test, Y_test) if k > 1: times.append(time.time() - start_time) print("Time: ", time.time() - start_time) print("RMSE: ", score) scores.append(score) matplotlib.pyplot.plot(space, scores, '+') matplotlib.pyplot.xlabel('Nearest Neighbours') matplotlib.pyplot.ylabel('RMSE') matplotlib.pyplot.title('User - User Collaborative Filtering') matplotlib.pyplot.savefig('../plots/user_user_collaborative_filtering1.png') matplotlib.pyplot.gcf().clear()