Hands-On Recommendation Systems with Python
eBook - ePub

Hands-On Recommendation Systems with Python

Start building powerful and personalized, recommendation engines with Python

Rounak Banik

  1. 146 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Hands-On Recommendation Systems with Python

Start building powerful and personalized, recommendation engines with Python

Rounak Banik

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

With Hands-On Recommendation Systems with Python, learn the tools and techniques required in building various kinds of powerful recommendation systems (collaborative, knowledge and content based) and deploying them to the web

Key Features

  • Build industry-standard recommender systems
  • Only familiarity with Python is required
  • No need to wade through complicated machine learning theory to use this book

Book Description

Recommendation systems are at the heart of almost every internet business today; from Facebook to Netflix to Amazon. Providing good recommendations, whether it's friends, movies, or groceries, goes a long way in defining user experience and enticing your customers to use your platform.

This book shows you how to do just that. You will learn about the different kinds of recommenders used in the industry and see how to build them from scratch using Python. No need to wade through tons of machine learning theory—you'll get started with building and learning about recommenders as quickly as possible..

In this book, you will build an IMDB Top 250 clone, a content-based engine that works on movie metadata. You'll use collaborative filters to make use of customer behavior data, and a Hybrid Recommender that incorporates content based and collaborative filtering techniques

With this book, all you need to get started with building recommendation systems is a familiarity with Python, and by the time you're fnished, you will have a great grasp of how recommenders work and be in a strong position to apply the techniques that you will learn to your own problem domains.

What you will learn

  • Get to grips with the different kinds of recommender systems
  • Master data-wrangling techniques using the pandas library
  • Building an IMDB Top 250 Clone
  • Build a content based engine to recommend movies based on movie metadata
  • Employ data-mining techniques used in building recommenders
  • Build industry-standard collaborative filters using powerful algorithms
  • Building Hybrid Recommenders that incorporate content based and collaborative fltering

Who this book is for

If you are a Python developer and want to develop applications for social networking, news personalization or smart advertising, this is the book for you. Basic knowledge of machine learning techniques will be helpful, but not mandatory.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Hands-On Recommendation Systems with Python un PDF/ePUB en línea?
Sí, puedes acceder a Hands-On Recommendation Systems with Python de Rounak Banik en formato PDF o ePUB, así como a otros libros populares de Ciencia de la computación y Inteligencia artificial (IA) y semántica. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Getting Started with Data Mining Techniques

In 2003, Linden, Smith, and York of Amazon.com published a paper entitled Item-to-Item Collaborative Filtering, which explained how product recommendations at Amazon work. Since then, this class of algorithmg has gone on to dominate the industry standard for recommendations. Every website or app with a sizeable user base, be it Netflix, Amazon, or Facebook, makes use of some form of collaborative filters to suggest items (which may be movies, products, or friends):
As described in the first chapter, collaborative filters try to leverage the power of the community to give reliable, relevant, and sometime, even surprising recommendations. If Alice and Bob largely like the same movies (say The Lion King, Aladdin, and Toy Story) and Alice also likes Finding Nemo, it is extremely likely that Bob, who hasn't watched Finding Nemo, will like it too.
We will be building powerful collaborative filters in the next chapter. However, before we do that, it is important that we have a good grasp of the underlying techniques, principles, and algorithms that go into building collaborative filters.
Therefore, in this chapter, we will cover the following topics:
  • Similarity measures: Given two items, how do we mathematically quantify how different or similar they are to each other? Similarity measures help us in answering this question.
    We have already made use of a similarity measure (the cosine score) while building our content recommendation engine. In this chapter, we will be looking at a few other popular similarity scores.
  • Dimensionality reduction: When building collaborative filters, we are usually dealing with millions of users rating millions of items. In such cases, our user and item vectors are going to be of a dimension in the order of millions. To improve performance, speed up calculations, and avoid the curse of dimensionality, it is often a good idea to reduce the number of dimensions considerably, while retaining most of the information. This section of the chapter will describe techniques that do just that.
  • Supervised learning: Supervised learning is a class of machine learning algorithm that makes use of label data to infer a mapping function that can then be used to predict the label (or class) of unlabeled data. We will be looking at some of the most popular supervised learning algorithms, such as support vector machines, logistic regression, decision trees, and ensembling.
  • Clustering: Clustering is a type of unsupervised learning where the algorithm tries to divide all the data points into a certain number of clusters. Therefore, without the use of a label dataset, the clustering algorithm is able to assign classes to all the unlabel points. In this section, we will be looking at k-means clustering, a simple but powerful algorithm popularly used in collaborative filters.
  • Evaluation methods and metrics: We will take a look at a few evaluation metrics that are used to gauge the performance of these algorithms. The metrics include accuracy, precision, and recall.
The topics covered in this chapter merit an entire textbook. Since this is a hands-on recommendation engine tutorial, we will not be delving too deeply into the functioning of most of the algorithms. Nor will we code them up from scratch. What we will do is gain an understanding of how and when they work, their advantages and disadvantages, and their easy-to-use implementations using the scikit-learn library.

Problem statement

Collaborative filtering algorithms try to solve the prediction problem (as described in the Chapter 1, Getting Started with Recommender Systems). In other words, we are given a matrix of i users and j items. The value in the ith row and the jth column (denoted by rij) denotes the rating given by user i to item j:
Matrix of i users and j items
Our job is to complete this matrix. In other words, we need to predict all the cells in the matrix that we have no data for. For example, in the preceding diagram, we are asked to predict whether user E will like the music player item. To accomplish this task, some ratings are available (such as User A liking the music player and video games) whereas others are not (for instance, we do not know whether Users C and D like video games).

Similarity measures

From the rating matrix in the previous section, we see that every user can be represented as a j-dimensional vector where the kth dimension denotes the rating given by that user to the kth item. For instance, let 1 denote a like, -1 denote a dislike, and 0 denote no rating. Therefore, user B can be represented as (0, 1, -1, -1). Similarly, every item can also be represented as an i-dimensional vector where the kth dimension denotes the rating given to that item by the kth user. The video games item is therefore represented as (1, -1, 0, 0, -1).
We have already computed a similarity score for like-dimensional vectors when we built our content-based recommendation engine. In this section, we will take a look at the other similarity measures and also revisit the cosine similarity score in the context of the other scores.

Euclidean distance

The Euclidean distance can be defined as the length of the line segment joining the two data points plotted on an n-dimensional Cartesian plane. For example, consider two points plotted in a 2D plane:
Euclidean distance
The distance, d, between the two points gives us the Euclidean distance and its formula in the 2D space is given in the preceding graph.
More generally, consider two n-dimensional points (or vectors):
  • v1: (q1, q2,...., qn)
  • v2: (r1, r2,....., rn)
Then, the Euclidean score is mathematically defined as:
Euclidean scores can take any value between 0 and infinity. The lower the Euclidean score (or distance), the more similar the two vectors are to each other. Let's now define a simple function using NumPy, which allows us to compute the Euclidean distance between two n-dimensional vectors using the aforementioned formula:
#Function to compute Euclidean Distance. 
def euclidean(v1, v2):

#Convert 1-D Python lists to numpy vectors
v1 = np.array(v1)
v2 = np.array(v2)

#Compute vector which is the element wise square of the difference
diff = np.power(np.array(v1)- np.array(v2), 2)

#Perform summation of the elements of the above vector
sigma_val = np.sum(diff)

#Compute square root and return final Euclidean score
euclid_score = np.sqrt(sigma_val)

return euclid_score
Next, let's define three users who have rat...

Índice

  1. Title Page
  2. Copyright and Credits
  3. Dedication
  4. Packt Upsell
  5. Contributors
  6. Preface
  7. Getting Started with Recommender Systems
  8. Manipulating Data with the Pandas Library
  9. Building an IMDB Top 250 Clone with Pandas
  10. Building Content-Based Recommenders
  11. Getting Started with Data Mining Techniques
  12. Building Collaborative Filters
  13. Hybrid Recommenders
  14. Other Books You May Enjoy
Estilos de citas para Hands-On Recommendation Systems with Python

APA 6 Citation

Banik, R. (2018). Hands-On Recommendation Systems with Python (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/778148/handson-recommendation-systems-with-python-start-building-powerful-and-personalized-recommendation-engines-with-python-pdf (Original work published 2018)

Chicago Citation

Banik, Rounak. (2018) 2018. Hands-On Recommendation Systems with Python. 1st ed. Packt Publishing. https://www.perlego.com/book/778148/handson-recommendation-systems-with-python-start-building-powerful-and-personalized-recommendation-engines-with-python-pdf.

Harvard Citation

Banik, R. (2018) Hands-On Recommendation Systems with Python. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/778148/handson-recommendation-systems-with-python-start-building-powerful-and-personalized-recommendation-engines-with-python-pdf (Accessed: 14 October 2022).

MLA 7 Citation

Banik, Rounak. Hands-On Recommendation Systems with Python. 1st ed. Packt Publishing, 2018. Web. 14 Oct. 2022.