Making a recommendation engine
Recommendation engines are a powerful way to boost sales on e-commerce websites, since they allow us to suggest to customers products that are likely to meet their preferences.
These suggestions are produced by looking at previous purchases (or wish lists and visited products) and comparing them with other customers and their purchases.
Basically, recommendation engines state that if you bought those products, you are similar to these other customers who also bought these products. So, probably, you will like these products as well.
Getting ready
In this recipe, we will compute the cosine measure of a matrix in order to measure similarity of vectors composing the matrix.
The lsa
package provides a specific cosine()
function for this purpose. In order to use it, we first have to install and load the package:
install.packages("lsa") library(lsa)
Our recommendation engine will be applied to a data frame that stores movie reviews from five critics, ranging from 1 to...