Recommendation algorithms
Bayes Theorem. Photo by Mattbuck under Creative Commons license, https://commons.wikimedia.org/wiki/File:Bayes%27_Theorem_MMB_01.jpg

Recommendation algorithms

Revisiting my graduation thesis, it brought back to my mind the initial curiosity that led me to write that thesis in the first place and the question that arose again is "how a recommendation system works?".

Probably many of you have already noticed that services like Netflix, Amazon and so on, recommend their products on their pages with some sort of sentence like "You may also like" and for those of you who have always wondered on how they make those recommendations, here is a brief explanation.

A recommendation system is based on some kind of machine learning algorithm, first the engineers have to decide which algorithm best suits their objectives, specially because there are many options and each option may deal better with some specific task, however it may not be the better option for a different task(e.g. a convolutional neural network is good for image recognition), on a brief note there is the supervised algorithms, which means that this kind of algorithm is trained with data and is able to predict something based on that data and there is also the unsupervised algorithms, in that case the algorithm is not able to make predictions but it is used to cluster data based on its similarities, therefore it is a great option to make classifications.

After the engineers have chosen the algorithm to create the model, they must train the model using the data collected from the users, or some other source, that step is crucial for the whole process, the data must be relevant, of good quality and big enough to enable the correct adjustment of the model, as the machine learning model is actually a statistical model, but in the case of the machine learning the internal function is automatically adjusted in such a manner, during the training, that the output matches the expected results associated with the data used to train it and there is no way of knowing which function it is.

Returning to the beginning of this article, my graduation thesis analysed a machine learning algorithm called naive Bayes, an algorithm based on the Bayes theorem.

P(A|B) = (P(B|A)P(A))/P(B)

Above is the Bayes theorem, it states that the probability of something happening, can be predicted by the prior knowledge of the probabilities of something related to that, for example, using Netflix in our example, the probability that a person will watch a given movie may be related by the time spent watching movies of the same genre, then using the time spent watching a horror movie can give us the probability that a person will watch any given horror movie, then we can stablish a threshold and if the probability surpasses that threshold the movie is recommended.

The naive Bayes algorithm is not the only algorithm used to make these predictions, but its advantage is the fact that this algorithm is not very computionally expensive, in other words, it is faster than others. The big problem with machine learning nowadays is training it, even using many clusters of GPU's(which is faster to process multidimensional vectors than CPU's) it may take several weeks, but on the other hand the naive Bayes algorithm can be trained in a few hours therefore it is a big option and should be taken into consideration if performance is a big issue.

To view or add a comment, sign in

More articles by Rodrigo Sipriano

  • Microbenchmarking

    Introduction Performance concerns, in software engineering, has been around for a while now and is a concern that has…

  • What actually is software performance?

    I've been writing a book about performance lately and I noticed that some commom misconceptions always arise when…

  • Understanding Kubernetes part 1

    Microservice x monolithic architectures Let's start from the beginning, well maybe that's not exactly the beginning of…

    1 Comment
  • Apache Kafka

    Franz Kafka is known as a writer who had a taste for the most absurd stories, like in his book metamorphosis, where he…

Others also viewed

Explore content categories