Mining High Average-Utility Itemsets in a Transaction Database with Utility Information using the HAUIM-GMU Algorithm (SPMF documentation)
This example explains how to run the HAUIM-GMU algorithm using the SPMF open-source data mining library.
How to run this example?
- If you are using the graphical interface, (1) choose the "HAUIM-GMU" 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 HAUIM-GMU 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 HAUIM-GMU?
HAUIM-GMU is an algorithm for discovering high average-utility itemsets (HAUIs) in a transaction database containing utility information proposed by Song et al. (2021).
What is the input?
HAUIM-GMU 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 HAUIM-GMU 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 HAUIM-GMU 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 HAUIM-GMU 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:
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 HAUIM-GMU 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.
1 #AUTIL: 35
1 2 #AUTIL: 24
1 3 #AUTIL: 27
1 3 4 #AUTIL: 26
1 4 #AUTIL: 29
2 #AUTIL: 26
2 3 #AUTIL: 25
3 #AUTIL: 34
3 4 #AUTIL: 27
4 #AUTIL: 27
For example, the first line indicates that the itemset {1} has an average-utility of 35. The following lines follows the same format.
Implementation details
This is the original implementation.
Performance
The HAUIM-GMU algorithm is a fast algorithm for high average utility itemset mining.
Where can I get more information about the HAUIM-GMU algorithm?
This is the reference of the article describing the HAUIM-GMU algorithm:
Song, W. et al. (2021) Generalized maximal utility for mining high average-utility itemsets, Knowledge and Information Systems, 63:2947–2967
Besides, for a general overview of high utility itemset mining, you may read this survey paper.