Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Recommendation Systems with Python

You're reading from   Hands-On Recommendation Systems with Python Start building powerful and personalized, recommendation engines with Python

Arrow left icon
Product type Paperback
Published in Jul 2018
Publisher Packt
ISBN-13 9781788993753
Length 146 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Rounak Banik Rounak Banik
Author Profile Icon Rounak Banik
Rounak Banik
Arrow right icon
View More author details
Toc

The cosine similarity score

We will discuss similarity scores in detail in Chapter 5, Getting Started with Data Mining Techniques. Presently, we will make use of the cosine similarity metric to build our models. The cosine score is extremely robust and easy to calculate (especially when used in conjunction with TF-IDFVectorizer).

The cosine similarity score between two documents, x and y, is as follows:

The cosine score can take any value between -1 and 1. The higher the cosine score, the more similar the documents are to each other. We now have a good theoretical base to proceed to build the content-based recommenders using Python.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime