This project implements a simplified version of the Hamm algorithm, originally presented in the TKDE 2023 paper:
"Mining High Utility Itemsets Using Prefix Trees and Utility Vectors"
This implementation adapts Hamm's Single Node Optimization and FP-tree in FP-Growth to solve the classic Frequent Itemset Mining (FPM) problem.
We provide a setup script that automates:
- System dependency checks (
g++) - Python virtual environment creation
- Library installation (
psutilfor resource monitoring) - C++ core compilation
chmod +x setup_env.sh
./setup_env.shPlace your raw transaction datasets in data_raw/.
Supported formats: .data, .txt
Format: Items separated by commas (e.g., f,n,t,l,won)
The system automatically applies Set Semantics:
- Duplicate items in the same transaction are merged/removed before tree construction.
Activate the environment:
source .venv/bin/activateRun all datasets with various ratios and parallel processes:
python3 experiment.py \
--datasets "mushroom,connect4,car,kr-vs-kp" \
--tx-ratios "10,50,100" \
--minsup-ratios "1,2,5" \
--override-default-minsup "mushroom=5,connect4=10" \
--parallel 4 \
--resumeStandard FP-Tree Structure Instead of the TV structure in the paper, this implementation utilizes the standard FP-Tree (as defined in the classic FP-Growth algorithm) to maintain itemset information, ensuring memory efficiency while adopting Hamm-style algorithmic flows.
The core mining process follows standard FP-Growth recursion:
- Header Table Traversal: Mining items from lowest to highest frequency.
- Conditional Pattern Base: Tracing prefix paths to build conditional FP-Trees.
- Conditional FP-Tree Construction: Mining recursively from each conditional tree.
To avoid excessive recursion, we integrate Hamm’s specific optimization:
- Detection: If a conditional tree (or the initial tree) is a single linear path (no branches), the algorithm stops recursion.
- Combinatorial Output: All frequent itemsets are generated directly from the path using combinations.
✅ This hybrid approach ensures the correctness of FP-Growth while gaining the speed of Hamm in dense datasets or deep trees.
| Argument | Description | Example |
|---|---|---|
--datasets |
Dataset names in data_raw/ |
mushroom,car |
--tx-ratios |
Percentage of transactions to use | 10,50,100 |
--tx-size |
Fixed number of transactions (overrides ratios) | 50000 |
--minsup-ratios |
Multipliers for base support | 0.5,1,2 |
--override-default-minsup |
Dataset-specific base minsup (%) | mushroom=5 |
--parallel |
Number of parallel processes | 4 |
--resume |
Skip already completed experiments | --resume |
src/Hamm.cpp # Core C++ implementation (FP-Growth + Hamm Opt)
tools/hamm # Compiled executable
experiment.py # Python experiment runner (with memory check)
setup_env.sh # Environment & build script
data_raw/ # Input datasets (.data or .txt)
results/ # Output patterns & performance logs
This project demonstrates that the Single Node Optimization proposed in Hamm is highly effective for Frequent Pattern Mining. By integrating these into an FP-Growth framework, we achieve a balance between:
- Classical recursive mining (FP-Growth)
- Modern utility-based mining optimizations (Hamm)