Visitor's probability to purchase on eCommerce site, based on aggregate historic data

On an eCommerce website we want to create some personalization for visitors who are more likely to make a purchase.

Let's assume we only have one single item for sale.

The likelihood should be based on data that we have, for example:

• Price of the item when the customer visited (it may vary)
• Average customer reviews rating of the item
• If a discount coupon was offered or not
• If certain words were present in the item title or description
• etc.

Our plan is to create a DB that will contain each visitor's visit data (the above data), and indication if eventually he made a purchase or not.

Once we have at least a few purchases, we need to somehow look for a pattern among all these cases, and based on this pattern we can later forecast the likelihood.

For example, if at least in 50% of the cases that the item was purchased, its price was no more than $100, than we will make personalization only on cases where the item is being sold at a max price of $100.

Does this make sense?

How should we do it technically? From both DB structure concerns, and website speed concern -

Should we collect each variable in its own DB column, or is it better to create some kind of long string in the browser session like p:99-r:4, (which means: price \$99, rating: 4) and then later break this data down using another script?

Is there some kind of library that can analyze this data and show it maybe in graph, like some fancy fronted, or does this project need to be made from scratch?

What kind of technical skills does the person who do it need to have? Is this related to machine-learning?

This is a big topic known as Recommender Systems or Recommendation Engines.

The most common method is use what is known as collaborative filtering. Most methods on the internet try to guess what the user will rank an item, but I think this can be extended to if the user will make a purchase or not, given that if a user were to rank something highly they would also be more likely to buy that item.

The idea is that each item has a n-dimensional vector, and each user has an n-dimensional vector. You can predict a user's predicted rating by some operation between the two vectors. In this example lets use the dot product between the two vectors as a means to predict the user's rating for an item they haven't yet seen.

While taking the 2 vectors and getting a prediction is not a machine learning problem, finding suitable values for the vectors is most definitely a machine learning problem. I won't get too deep into how you can get these vectors because many different algorithms apply and it seems that you are asking more of a system design question.

Once you have trained 1 vector for each user and 1 vector for each item, you have 2 more problems to solve: 1. Estimate the top N candidate items to recommend 2. Take the dot product between each of these N items and recommend the few with the highest score.

Number 1 will likely involve some use of spatial indexing in your database (example PostGIS for PSQL) so you can find some vectors that would give reasonably good dot-products. You may want to consider using a ball tree data structure to search for a good set of candidate items.

Number 2 will be pretty simple by just dotting the vectors and picking the best few.

It will be a big challenge for you to undertake but I'm certain you'll learn a lot. Since it was such a big system you want to create I wasn't able to go into detail but hopefully, I pointed you in the right direction.

• Thanks for the insight. I'm surely interested as well in a recommend algorithm to use. do you think in general that my idea can eventually really translate into actionable insight that can increase sales (that's my goal of course), or is there too much missing information that I could never model (such as, the user's characteristics) so my attempt to create such algorithm will not be fruitful? about the users I don't think I have any insightful data (they are annonymous), so I guess I can only assume they are identical, and try modeling based on the item only. – rockyraw May 2 '18 at 21:35
• In general yea, I think that something like this can definitely increase sales. Many people are doing it (Amazon has been doing something like this for ~20 years). The most valuable part of this is keeping data on the user or getting it from a different source if possible. Even though the users are anonymous you can still track them over multiple sessions with cookies. Just remember that with a system like this, its limits are how much data it has and how closely that data relates to predicting purchasing. – Aidan Rosswood May 3 '18 at 1:50