Hands-On Data Science for Marketing by Yoon Hyup Hwang
Author:Yoon Hyup Hwang
Language: eng
Format: epub
Tags: COM062000 - COMPUTERS / Data Modeling and Design, COM004000 - COMPUTERS / Intelligence (AI) and Semantics, COM089000 - COMPUTERS / Data Visualization
Publisher: Packt Publishing
Published: 2019-03-29T07:02:11+00:00
User-based collaborative filtering and recommendations
In order to build a user-based collaborative filtering algorithm, we need to compute cosine similarities between users. Let's take a look at the following code:
# User-to-User Similarity Matrix
userToUserSimMatrix <- cosine(
as.matrix(
# excluding CustomerID column
t(customerItemMatrix[, 2:dim(customerItemMatrix)[2]])
)
)
colnames(userToUserSimMatrix) <- customerItemMatrix$CustomerID
As is noticeable from this code, using the cosine function from the coop library, you can compute and build a cosine similarity matrix. One thing to note in this code is the fact that we transpose the customerItemMatrix before computing cosine similarities. This is to compute user-to-user similarities. Without the transposition, the cosine function will be computing item-to-item similarities. Lastly, we are renaming the columns with customer IDs in the last line of this code.
The result looks as follows:
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Computer Vision & Pattern Recognition | Expert Systems |
Intelligence & Semantics | Machine Theory |
Natural Language Processing | Neural Networks |
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8309)
Test-Driven Development with Java by Alan Mellor(6773)
Data Augmentation with Python by Duc Haba(6688)
Principles of Data Fabric by Sonia Mezzetta(6435)
Learn Blender Simulations the Right Way by Stephen Pearson(6335)
Microservices with Spring Boot 3 and Spring Cloud by Magnus Larsson(6209)
Hadoop in Practice by Alex Holmes(5965)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5813)
RPA Solution Architect's Handbook by Sachin Sahgal(5606)
Big Data Analysis with Python by Ivan Marin(5387)
The Infinite Retina by Robert Scoble Irena Cronin(5298)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5154)
Pretrain Vision and Large Language Models in Python by Emily Webber(4352)
Infrastructure as Code for Beginners by Russ McKendrick(4116)
Functional Programming in JavaScript by Mantyla Dan(4042)
The Age of Surveillance Capitalism by Shoshana Zuboff(3961)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3832)
Embracing Microservices Design by Ovais Mehboob Ahmed Khan Nabil Siddiqui and Timothy Oleson(3632)
Applied Machine Learning for Healthcare and Life Sciences Using AWS by Ujjwal Ratan(3605)
