function to calculate cosine similarity.
high level documentation of steps in the recommender.