SPMF documentation >Mining Frequent High-Utility Itemsets from a Database with Utility Information with the FHMFreq Algorithm

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

How to run this example?

What is FHMFreq?

FHM (Fournier-Viger et al., ISMIS 2014) is an algorithm for discovering high-utility itemsets in a transaction database containing utility information. FHMFreq is a simple extension of FHM for discovering frequent high-utility itemsets (it combines frequent itemset mining with high-utility itemset mining).

High utility itemset mining has several applications such as 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.

What is the input?

FHMFreq takes as input a transaction database with utility information, a minimum utility threshold min_utility (a positive integer), and a minimum support threshold minsup (a percentage value represented as a double in [0,1]). Let's consider the following database consisting of 5 transactions (t1,t2...t5) and 7 items (1, 2, 3, 4, 5, 6, 7). This database is provided in the text file "DB_utility.txt" in the package ca.pfv.spmf.tests of the SPMF distribution.


Items Transaction utility Item utilities for this transaction
t1 3 5 1 2 4 6 30 1 3 5 10 6 5
t2 3 5 2 4 20 3 3 8 6
t3 3 1 4 8 1 5 2
t4 3 5 1 7 27 6 6 10 5
t5 3 5 2 7 11 2 3 4 2

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 3, 5, 1, 2, 4 and 6. The amount of money spent for each item is respectively 1 $, 3 $, 5 $, 10 $, 6 $ and 5 $. The total amount of money spent in this transaction is 1 + 3 + 5 + 10 + 6 + 5 = 30 $.

What is the output?

The output of FHMFreq is the set of frequent high utility itemsets having a utility no less than a min_utility threshold (a positive integer) set by the user, and a support no less than the minsup threshold also set by the user. To explain what is a high utility itemset, it is necessary to review some definitions. An itemset is an unordered set of distinct items. The utility of an itemset in a transaction is the sum of the utility of its items in the transaction. For example, the utility of the itemset {1 4} in transaction t1 is 5 + 6 = 11 and the utility of {1 4} in transaction t3 is 5 + 2 = 7. The utility of an itemset in a database is the sum of its utility in all transactions where it appears. For example, the utility of {1 4} in the database is the utility of {1 4} in t1 plus the utility of {1 4} in t3, for a total of 11 + 7 = 18. The support of an itemset is the number of transactions containing the itemset. For example, the support of itemset {1 4} is 2 transactions because it appears in transactions t1 and t3. The support of an itemset can also expressed as a percentage. For example, the support of itemset {1 4} is said to be 40% (or 0.4) because it appears in 2 out of five transactions in the database.

A frequent high utility itemset is an itemset such that its utility is no less than min_utility and that its support is no less than the minsup threshold. For example, if we run FHMFreq with a minimum utility of 30 and a minimum support of 40 %, we obtain 7 high-utility itemsets:

itemsets utility support
{2 4} 30 40 % (2 transactions)
{2 5} 31 60 % (3 transactions)
{1 3 5} 31 40 % (2 transactions)
{2 3 4} 34 40 % (2 transactions)
{2 3 5} 37 60 % (3 transactions)
{2 4 5} 36 40 % (2 transactions)
{2 3 4 5} 40 40 % (2 transactions)

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 30 $ or more, and appear in at least 2 transactions.

Input file format

The input file format of FHMFreq 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:

3 5 1 2 4 6:30:1 3 5 10 6 5
3 5 2 4:20:3 3 8 6
3 1 4:8:1 5 2
3 5 1 7:27:6 6 10 5
3 5 2 7:11:2 3 4 2

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

Output file format

The output file format of FHMFreq is defined as follows. It is a text file, where each line represents a frequent high 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 " #UTIL: " appears and is followed by the utility of the itemset. After, the keyword " #SUP: " appears and is followed by the support of the itemset. For example, we show below the output file for this example.

4 2 #UTIL: 30 #SUP: 2
4 2 5 #UTIL: 36 #SUP: 2
4 2 5 3 #UTIL: 40 #SUP: 2
4 2 3 #UTIL: 34 #SUP: 2
2 5 #UTIL: 31 #SUP: 3
2 5 3 #UTIL: 37 #SUP: 3
1 5 3 #UTIL: 31 #SUP: 2

For example, the first line indicates that the itemset {2, 4} has a utility of 30 and a support of two transactions. The following lines follows the same format.

Performance

High utility itemset mining is a more difficult problem than frequent itemset mining. Therefore, high-utility itemset mining algorithms are generally slower than frequent itemset mining algorithms.

The FHMFreq algorithm here described is a simple extension of the FHM algorithm to add the minsup threshold as parmeter.

For high-utility itemset mining, the FHM algorithm was shown to be up to six times faster than HUI-Miner (also included in SPMF), especially for sparse datasets (see the performance section of the website for a comparison). But the EFIM algorithm (also included in SPMF) greatly outperforms FHM (see performance section of the website).

Implementation details

The version of FHMFreq offered in SPMF extends the original implementation of FHM.

Note that the input format is not exactly the same as described in the article. But it is equivalent.

Where can I get more information about the FHMFreq algorithm?

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

Fournier-Viger, P., Wu, C.-W., Zida, S., Tseng, V. (2014) FHM: A Faster High-Utility Itemset Mining Algorithm using Estimated Utility Co-occurrence Pruning. Proc. 21st International Symposium on Methodologies for Intelligent Systems (ISMIS 2014), Springer, LNAI, pp. 83-92

The FHMFreq algorithm is a simple extension of that algorithm.

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

<< Return to table of contents of SPMF documentation

Copyright © 2008-2020 Philippe Fournier-Viger. All rights reserved.