Consider how cosine similarity is calculated.

Cosine similarity takes the dot product of two real vectors, and divides this value by the product of their magnitudes. By the Euclidean dot product identity, this is equal to the cosine of the angle between the two vectors. The upshot of this is a value between 1 and -1.

When the value is 1, those vectors are pointing in exactly the same direction. When the value is -1, the vectors are pointing in exactly the opposite direction (one is the negation of the other). When the value is 0, the vectors are perpendicular to one another; in other words, when the value is zero, these two vectors are as unalike in the feature space as it is possible to get.

The dot product is the sum of all the element-wise products of your two vectors. The bigger those numbers, the more they contribute to the cosine similarity.

Now, take any feature in your vector. The fifth, say. If you set this to zero in one of your vectors, the fifth element in the element-wise product of the two vectors will also be zero, regardless of its value in the other vector. When you sum up all these element-wise products, the fifth element will not have any impact on the summation. As a result, setting a value in your feature vector to zero means it doesn't make any contribution to the cosine similarity.

This is why setting a value to zero in a feature vector is equivalent to not including the feature in the calculation of cosine similarity, and does not does not distort cosine similarity.

You can look at this question on stackoverflow for getting more insight about this.

– janpreet singh – 2016-09-12T07:21:57.177The answer partly answers the question as it shows that keeping not rated entries as 0 will definitely effect the corresponding similarity. Which could be (or not) used in the algorithm for recommender engine – janpreet singh – 2016-09-12T07:35:10.323

Have you tried mean-normalization? – Valentin Calomme – 2018-01-31T09:22:42.487