Mining High Average-Utility Itemsets in a Transaction Database with Utility Information using the EMAUI Algorithm (SPMF documentation)
This example explains how to run the EMAUI algorithm using the SPMF open-source data mining library.
How to run this example?
- If you are using the graphical interface, (1) choose the "EMAUI" algorithm, (2) select the input file "contextHAUIMiner.txt", (3) set the output file name (e.g. "output.txt") (4) set the minimum utility to 24 and (5) click "Run algorithm".
- If you want to execute this example from the command line,
then execute this command:
java -jar spmf.jar run EMAUI contextHAUIMiner.txt output.txt 24 in a folder containing spmf.jar and the example input file contextHAUIMiner.txt. - If you are using the source code version of SPMF, launch the file "MainTestHAUIMiner_saveToFile.java" in the package ca.pfv.SPMF.tests.
What is EMAUI?
EMAUI is an algorithm for discovering high average-utility itemsets (HAUIs) in a transaction database containing utility information. It was proposed by Li et al. (2022). Like HAUI-Miner, it explores a set-enumeration tree depth-first and uses a vertical list structure, so that the average-utility of an itemset can be computed by joining the lists of smaller itemsets, without rescanning the database. EMAUI improves on this approach with three ideas:
- A novel list structure, the key-feature average-utility list (KFAU-list). For each transaction containing an itemset, the list stores the utility of the itemset and a few key features of the items that remain after it in the transaction: the maximum remaining utility, the second-largest remaining utility, the number of remaining items, and the distance to the rightmost maximum. These features are computed once during a backward scan of each transaction, and they are all that is needed to bound the utility of any extension.
- A tighter upper bound (EMU). From the key features of each transaction, EMU bounds the average-utility that any proper extension of an itemset can reach in that transaction. If the sum of these bounds is below minAUtility, none of the extensions of the itemset can be a HAUI, so the whole branch of the search tree is skipped. EMU is tighter than the sum of the remaining maximum utilities used by HAUI-Miner, so more of the search space is pruned.
- An early-abandoning strategy. When two lists are joined to build a longer itemset, the algorithm starts from the EMU of the first list and subtracts the contribution of each transaction in which the second item does not appear. As soon as the remaining bound falls below minAUtility, the join is stopped and the candidate is discarded.
What is the input?
EMAUI 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:
- A set of items (the first column of the table),
- The sum of the utilities (e.g. profit) of these items in this transaction (the second column of the table),
- The utility of each item for this transaction (e.g. profit generated by this item for this transaction)(the third column of the table).
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 EMAUI 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 EMAUI 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 EMAUI is defined as follows. It is a text file. Each lines represents a transaction. Each line is composed of three sections, as follows.
- First, the items contained in the transaction are listed. An item is represented by a positive integer. Each item is separated from the next item by a single space. It is assumed that all items within a same transaction (line) are sorted according to a total order (e.g. ascending order) and that no item can appear twice within the same transaction.
- Second, the symbol ":" appears and is followed by the transaction utility (an integer).
- Third, the symbol ":" appears and is followed by the utility of each item in this transaction (an integer), separated by single spaces.
For example, for the previous example, the input file is defined as follows:
@FILETYPE="Transaction database with utility values"
@SOURCE="SPMF SOFTWARE https://philippe-fournier-viger.com/spmf/"
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
The first two lines are optional metadata. The first line indicate the type of file and the second line describes the source of the data. Then it is the data section. 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 EMAUI is defined as follows. It is a text file. The first two lines are metadata indicating the type of patterns in this file and the source of the data. Then the following lines provide the list of patterns, 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.
@FILETYPE="High average-utility itemsets"
@SOURCE="SPMF SOFTWARE https://philippe-fournier-viger.com/spmf/"
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.
Implementation details
The version implemented here contains all the optimizations described in the paper proposing EMAUI. Note that the input format is not exactly the same as described in the original article. But it is equivalent.
Performance
The EMAUI algorithm is a fast algorithm for high average utility itemset mining. However, the EHAUPM algorithm is reported to be up to 5 times faster than EMAUI and is also offered in SPMF.
Where can I get more information about the EMAUI algorithm?
This is the reference of the article describing the EMAUI algorithm:
Li, G., Shang, T., & Zhang, Y. (2022). Efficient mining high average-utility itemsets with effective pruning strategies and novel list structure. Applied Intelligence, 53(5), 6099-6118.
Besides, for a general overview of high utility itemset mining, you may read this survey paper.