# Algorithm for learning combination preferences

I believe I'm looking for some kind of preference algorithm.

Imagine we have three lists. List 1 is appetizers, List 2 is main courses, and List 3 is deserts. Lets assume each list has 50 options in it. I want to randomly present the user with a combination of three items, one from List 1, one from List 2, and one from List 3. The user will give a thumbs up or down to the combo, and over time I'd like the to be able to "learn" the user's preferences, so a chicken fingers > fried chicken > fried ice cream combo that gets a thumbs down the first time should never be suggested again. However, a combo consisting of chicken fingers > fried chicken > sorbet would still be valid.

That all seems pretty simple: I could just maintain a list of rejected combos. However, I'd like the algorithm to have some sense that chicken fingers > friend chicken might be a problem, regardless of what desert it is paired with. This "sense" of those two being a bad combo would get stronger if the chicken fingers > fried chicken > sorbet option was rejected as well.

Are there any types of algorithms that are used for this sort of thing?

-

## 2 Answers

The algorithm cannot have the sense, you have to give it the sense while computing it. The list of rejected memories is the best idea, but to reduce the problem like you want to, you need to tell the algorithm the minimum number of chicken fingers > friend chicken combos that you want to be rejected before it can be considered as a bad combo.

    count=0;
if(chicken fingers > friend chicken > anyoption in rejected_list_of_3)
count++
if(count>= minimum_reject)
add chicken fingers > friend chicken to new_reject_list_of_2


Note that for this to help the algorithm, you will have to give the reject list of 2-combo a priority over the reject list of 3-combo since it contains less data. That is a reject list of 2-combo contains a maximum of $n^2$ data while a reject list of 3-combo contains a maximum of $n^3$ data.

-

If you would like to understand buyers' purchasing patterns, and you have enough data, then you may want to have a look at Market Basket Analysis.

The term market basket analysis in the retail business refers to research that provides the retailer with information to understand the purchase behaviour of a buyer (Wikipedia).

MBA elaborates buyers' purchases data to discover patterns. For example, it may find that 80% of the purchases involve chicken fingers and sorbet, and only 1% of the time chicken fingers and fried chicken are bought together.

It may works also on-line (with continuosly generated data). You can google it for the possible algorithms.

-