What should be the value of non-rated field when finding cosine similarity I am working on a very basic book recommender system. I want to know what to do with the fields which aren't rated by the user when finding cosine similarity, should we ignore them and calculate only with the rated fields or should we mark them 0.

The book I am following says to exclude the fields since it will give wrong interpretation in case of Euclidean and Pearson Correlation but in case of Cosine Similarity, it makes all the non-rated fields to 0.

Can someone explain why is it needed to make the non-rated fields to 0 only for Cosine and not others or is there a different way to do it.
(I know how making fields 0 in Euclidean and Pearson affect the output but not sure of cosine)
Implementation-side, there is a good reason to make 0 correspond to not rated.  Since most users haven't rated most books, 0 will be the most common value and the cosine similarity function can use sparse matrices internally to speed up the computation.  The sparse matrix shortcut is the main reason why people use cosine similarity in the first place.

On the other hand, it will throw off your recommendations if the algorithm interprets a 0 to be closer to a 1 than a 2. You do need to intentionally ignore those, but you can easily do so inside your cosine similarity implementation rather than filtering the data before applying it.