File formats¶
Transaction database (input)¶
A plain-text file with two parts.
- The first line is a single integer: the number of transactions.
- Every subsequent non-blank line is one transaction with three tab-separated fields:
| Field | Meaning |
|---|---|
| 1 | Transaction id (integer). |
| 2 | Number of items in the transaction (integer). |
| 3 | Items separated by single spaces. |
Example:
The field separator is a tab, not a comma or space. By default items are
parsed as integers; pass item_parser=str (or another callable) to
read_database for other item types.
The item count field is read but not enforced against the actual number of items. The declared transaction count is likewise not enforced.
Parsing rules¶
- Blank lines are ignored.
- A line without exactly three tab-separated fields raises
ValueError. - The transaction id and item count must parse as integers.
Results file (output)¶
The first line is:
Each following line is one frequent itemset:
where <items> are the items separated by single spaces and <support> is the
absolute support count. Lines are sorted by itemset size and then by their
rendered text, which makes the file deterministic.
Example: