Run the command line tool¶
This guide shows how to mine frequent itemsets from a transaction database file
using the fpgrowth command. It assumes the package is installed (see
Getting started); if it is not, prefix the
commands with PYTHONPATH=src and use python3 -m fpgrowth instead of
fpgrowth.
Mine a database¶
| Option | Meaning | Default |
|---|---|---|
-i, --in_file |
Input transaction database. Required. | — |
-o, --out_file |
Output results file. | MiningResults.txt |
-m, --min_supp |
Relative minimum support in [0, 1]. |
0.5 |
Example:
Interpret the minimum support¶
-m is relative: it is multiplied by the number of transactions to obtain
the absolute count an itemset must reach. With four transactions, -m 0.5
requires support >= 2.
To require an absolute count, divide it by the transaction count. For example,
to require support >= 3 in a 4-transaction database, use -m 0.75.
Read the output¶
The output file begins with |FPs| = <count> and then lists each frequent
itemset as <items> : <support>. Lines are sorted by itemset size and content,
so the file is deterministic. See the
file formats reference.
The command also prints the total number of frequent itemsets to standard output.
Exit behaviour¶
- On success the process returns
0. - If
-mis outside[0, 1], the tool raisesValueError(a non-zero exit). - If the input file is missing or malformed, Python raises
OSErrororValueErrordescribing the problem.