Mining High Average-Utility Itemsets in a Transaction Database with Utility Information using the EHAUPM Algorithm (SPMF documentation)

This example explains how to run the EHAUPM algorithm using the SPMF open-source data mining library.

How to run this example?

What is EHAUPM?

EHAUPM is an algorithm for discovering high average-utility itemsets (HAUIs) in a transaction database containing utility information. The EHAUPM algorithm discovers HAUIs by exploring a set-enumeration tree using a depth-first search. An efficient pruning strategy is also developed to prune unpromising candidates early and thus reduce the search space.

High average utility itemset mining has several applications, for example, discovering groups of items in transactions of a store that generate the most profit. A database containing utility information is a database where items can have quantities and a unit price. Although these algorithms are often presented in the context of market basket analysis, there exist other applications such as finding groups of webpages from user browsing logs.

What is the input?

EHAUPM takes as input a transaction database with utility information and a minimum utility threshold minAUtility (a positive integer). Let's consider the following database consisting of six transactions (t1, t2, ... , t6) and 6 items (1, 2, 3, 4, 5, 6). This database is provided in the text file "contextHAUIMiner.txt" in the package ca.pfv.spmf.tests of the SPMF distribution.

Items

Transaction utility

Item utilities for this transaction

t1

1 2 3 4 6

32

5 6 6 9 6

t2

2 3 5

16

2 6 8

t3

1 3 4 5

22

10 2 6 4

t4

1 2 3 4 6

28

5 9 6 6 2

t5

1 2 3 4 5

37

15 9 6 3 4

t6

3 4 5

15

8 3 4

Each line of the database is:

Note that the value in the second column for each line is the sum of the values in the third column.
What are real-life examples of such a database? There are several applications in real life. One application is a customer transaction database. Imagine that each transaction represents the items purchased by a customer. The first customer named "t1" bought items 1, 2, 3, 4 and 6. The amount of money spent for each item is respectively 5 $, 6 $, 6 $, 9 $ and 6 $. The total amount of money spent in this transaction is 5 + 6 + 6 + 9 + 6 = 32 $.

What is the output?

The output of EHAUPM is the set of high average-utility itemsets having an average-utility no less than a minAUtility threshold (a positive integer) set by the user. Average utility measure estimates the utility of an itemset by considering its length. It is defined as the sum of the utilities of the itemset in transactions where it appears, divided by the number of items that it contains. For example, the average-utility of {2, 3, 5} in the database is the utility of {2, 3, 5} in t2 plus the utility of {2, 3, 5} in t5, for a total of 16 + 19 = 35, divide by 3, equals 11.6. A high average-utility itemset is an itemset such that its utility is no less than minAUtility. For example, if we run EHAUPM with a minimum utility of 24, we obtain 10 high average-utility itemsets.

itemsets

average-utility

{1}

35

{2}

26

{3}

34

{4}

27

{1 2}

24.5

{1 3}

27.5

{1, 4}

29.5

{2, 3}

25

{3, 4}

27.5

{1, 3, 4}

26.3

If the database is a transaction database from a store, we could interpret these results as all the groups of items bought together that generated a profit of 24 $ or more, when divided by the number of items.

Input file format

The input file format of EHAUPM is defined as follows. It is a text file. Each lines represents a transaction. Each line is composed of three sections, as follows.

For example, for the previous example, the input file is defined as follows:

1 2 3 4 6:32:5 6 6 9 6
2 3 5:16:2 6 8
1 3 4 5:22:10 2 6 4
1 2 3 4 6:28:5 9 6 6 2
1 2 3 4 5:37:15 9 6 3 4
3 4 5:15:8 3 4

Consider the first line. It means that the transaction {1, 2, 3, 4, 6} has a total utility of 32 and that items 1, 2, 3, 4, and 6 respectively have a utility of 5, 6, 6, 9 and 6 in this transaction. The following lines follow the same format.

Output file format

The output file format of EHAUPM is defined as follows. It is a text file, where each line represents a high average-utility itemset. On each line, the items of the itemset are first listed. Each item is represented by an integer, followed by a single space. After, all the items, the keyword " #AUTIL: " appears and is followed by the average utility of the itemset. For example, we show below the output file for this example.

2 #AUTIL: 26.0
2 1 #AUTIL: 24.5
2 3 #AUTIL: 25.0
1 #AUTIL: 35.0
1 4 #AUTIL: 29.5
1 4 3 #AUTIL: 26.333333333333332
1 3 #AUTIL: 27.5
4 #AUTIL: 27.0
4 3 #AUTIL: 27.5
3 #AUTIL: 34.0

For example, the first line indicates that the itemset {2} has an average-utility of 26. The following lines follows the same format.

Performance

It can be argued that the average utility measure used in high average-utility itemset mining (HAUIM) is a more fair measure than the utility measure used in high utility itemset mining (HUIM). The reason is that long itemsets may tend to have a very high utility, compared to short itemsets. Therefore, Hong et al proposed discovering high average utility itemsets but the upper bounds used in HUIM to explore the search space efficiently cannot be used for HAUIM . Many algorithms have been proposd to improve the performance of HAUIM. However most of them utilize the AUUB upper bound model proposed by Hong et al. To further improve the performance, the EHAUPM algorithm propose two novel upper bounds and three pruning strategies. Experiments on several real datasets have shown that it is up to five or six times faster than the state-of-art HAUI-Miner algorithm (also offered in SPMF).

Implementation details

The version implemented here contains all the optimizations described in the paper proposing EHAUPM. Note that the input format is not exactly the same as described in the original article. But it is equivalent.

Where can I get more information about the EHAUPM algorithm?

This is the reference of the article describing the EHAUPM algorithm:

Lin C-W J, Ren S, Fournier-Viger P. EHAUPM: Efficient High Average-Utility Pattern Mining With Tighter Upper Bounds[J]. IEEE Access, 2017, 5: 12927-12940.

Besides, for a general overview of high utility itemset mining, you may read this survey paper.