Pearson correlation with vector that has the same ratings (0 division)

18 Views Asked by At

I'm currently making a recommender system, using collaborative filtering and the pearson correlation to find similarities between users.

I've made a working function for the pearson correlation, however it has a division by 0 problem. When the vector, in this case the user, has rated all the items the same, the average of the items will be the same as the rating for all the items. Normalizing that data, will make all the ratings a 0. The pearson correlation requires a computation with that 0, which is a division by 0, which shouldn't be possible. What can be done to avoid this problem?