Today, I will do a quick post on how to automatically adjust the minimum support threshold of frequent pattern mining algorithms such as Apriori, FPGrowth and PrefixSpan according to the size of the data.
The problem is simple. Let’s consider the Apriori algorithm. The input of this algorithm is a transaction database and a parameter called minsup that is a value in [0,1]. The output of Apriori is a set of frequent patterns. A frequent pattern is a pattern such that its support is higher or equal to minsup. The support of a pattern (also called “frequency”) is the number of transactions that contains the pattern divided by the total number of transactions in the database. A key problem for algorithms like Apriori is how to choose a minsup value to find interesting patterns. There is no really easy way to determine the best minsup threshold. Usually, it is done by trial and error. Now let’s say that you have determined that for your application the best minsup.
Now, consider that the size of your data can change over time. In this case how can you dynamically adjust the minimum support so that when you don’t have a lot of data the threshold is higher? and that when you have more data, the threshold becomes lower ?
A simple solution that I have found is to use a mathematical function for adjusting the minsup threshold automatically according to the database size (the numer of transactions for Apriori). This solution is shown below.
I choose to use the formula minsup(x) = (e^(-ax-b))+c where x is the number of transactions in the database and a,b,c are constants because it sets minsup to a high value when there is not a lot of data and then decrease minsup when there is more data. For example, on the first chart below, minsup value is set to 0.7 if there is 1 transaction, it becomes 0.4 when there is 3 transactions and then decrease to 0.2 when there is around 9 transactions. This allow the minsup threshold to become more strict when there is less data. Note that the constantsa,b and c are can be adjusted to make the curve behave differently.
On the second chart above, I show the relative minsup threshold. It is simply the minsup threshold multiplied by the database size. It shows the number of transactions in which a pattern need to appear to become frequent according to the database size.
Hope this little trick is helpful!
Next time, I will try to talk about some more general data mining topic. I promised that I would do that last time. But today I wanted to talk about this topic, so I will rather do that next time!
Founder of the SPMF data mining software