Repository navigation
Releases
v0.2.0
Added
-
fpgpsp, the second program of the upstream sources, ascmd/fpgpsp:
pattern spectra from surrogate data (transaction randomization-gr,
pair swaps-gp, column shuffles of table data-gs, identity-gi)
or estimated (-ge), and the decision border (-D) for fpgrowth's
-F. Same options, formats, messages and exit codes as upstream's
fpgpsp 1.3, with its defects fixed (rows U1-U25 in
docs/differences.md: surrogates from all records, every surrogate
mined on its own, the full decision border, the estimation's
frequencies and slot counts, no data races, and others); one argument
writes to standard output; the seed and the number of chains are
printed when left at their defaults; SIGINT exits with status 130. The
result depends on the seed and the number of chains (upstream's
threads), not on the machine. Release archives contain both programs.
reference/build.sh fpgpspbuilds upstream's program,fpgpsp-fixed
the differential oracle with the fixes (reference/patches/fpgpsp/),
andreference/difftestTestFpgpspcompares the two programs (#23). -
CLI: option
-zwrites the item set/rule output (a file or standard
output) as one zlib stream (RFC 1950, default level, pure Go
compress/zlib), like upstream's optional build withUSE_ZLIB. The
decompressed output equals the output without-z;-Z,-Pand the
log are not compressed (with-Zand the item sets on standard output
the statistics follow the stream), count-only mode is unchanged, and
write or close errors of the stream give exit status 4. The usage text lists-zas that build does
(deviation O12).reference/build.sh zlibbuilds the C oracle with
USE_ZLIB, and the reference testTestZlibcompares decompressed
outputs with it (#22). -
Tests: the test oracle (
internal/oracle) has an independent reference
for all 25 rule evaluation measures andLogSupportRatio, written from
the definitions with exact arithmetic, and the oracle comparisons check
every evaluation value against it, so a wrong measure formula now fails
go test ./...without the C-derived fixtures (audit TST-3, #15). The
known numerical defects for large total weights (ALG-1, ALG-2, ALG-6)
are recorded in expected-failure tables (all three are fixed since, see
below, and the tables are gone). No library or CLI behavior changes. -
Benchmarks: the dense maximal workload of audit finding M5A-1
(d20000x200d30: 20,000 transactions, 200 independent items at 30 %)
is a pinned dataset of the benchmark generator, and the Go-vs-C
comparison hasm5-d20000-*rows for it (-tc/-tmwith-n2to
-n4), so the size-limited maximal check can be measured from
committed code (#19). -
Benchmarks: the long-and-short shapes of the closed check (
lp12500
tolp100000,lp50000s2,lp50000w,lpc20000) and the probe
trap of its design review (adv5-20000,adv5-40000) are pinned
datasets withlp-*andadv5-*rows in the Go-vs-C comparison
(#20). -
Benchmarks: the perfect-extension shapes of issue #21 (the audit's T4
chaint4-6250tot4-25000, and the wide linesone-6250,
one-12500,t4b-3000,t4b-6000) are pinned datasets witht4-*,
one-*andt4b-*rows in the Go-vs-C comparison, and
go run ./bench/gen -listno longer panics on the probe trap
datasets (#21). -
Benchmarks: maximal rows for the long-and-short shapes
(lp-12500-m-As,lp-25000-m-As,lp-50000s2-m-n1,lp-50000w-m,
lp-c20000-m) in the Go-vs-C comparison (#34). -
Benchmarks:
dense -tm -s5 -n3/-n4rows (dense-m-n3,
dense-m-n4) in the Go-vs-C comparison and as
BenchmarkSuiteMaxSize/dense/s=5/maximal/n=3/n=4; the two
adversaries of the maximal check's deferral from the reviews of #34
are pinned datasets (advb-101,advc-100-250) with rows
advb-101-mandadvc-100-250-m(#42).
Changed
-
Performance against the C program, on one machine (Apple M1 Max;
docs/benchmarks.md, "Go vs C on 2026-10-30"): on the 32 main
configurations the CLI takes 1.37 times C's wall time with output to
/dev/null(geometric mean, range 1.08-1.59), against 1.61 at v0.1.0, and
1.8-2.1 times its instructions (2.1-3.9). Size-limited closed/maximal
mining on large sparse data takes 1.6-2.2 times C's wall time (2.2-3.2).
Shapes that were quadratic now finish far ahead of C (50,000 long and
short transactions: 36 ms against 3.4 s).fpgpsptakes 0.59 to 2.75
times the instructions of the fixed C program, depending on the method.
An input over the CLIs' 128 MiB budget is still read twice, about 2.6
times C's instructions. -
fpgpspgenerates surrogate data sets with fewer instructions and
almost no allocation per data set. Every surrogate is still counted,
recoded and mined on its own with the item codes, prefix-tree bag and
miner of the fresh pipeline, but on reused storage: a dense item base
without a map (tract.DenseBase), the bag's node storage, the
miner's arenas, scratch arrays and 16-items machines (fpg.Workspace)
are kept per worker (psp.Workspace). Transaction randomization
(-gr) finds its draws in a prefix-sum (Fenwick) tree and its repair
items in a bit set instead of linear searches, with the same random
numbers and surrogates; transactions are sorted by a key of their first
two items. Against main (instructions retired, Apple M1 Max): 20,000
sparse transactions-gr-68 % (now 0.61 times the C oracle's
instructions, 1.93 before),-gp-16 %; a 5,000 x 10 table-gs
-20 %,-gp-18 %; 4,000 x 40 dense-gp -c64-25 % (-Z64-17 %);
-geis unchanged (it generates no surrogates). About 0.09 MB
instead of 3.3 MB allocated per surrogate. The output is byte-identical
for every method, target, variant and number of chains or workers
(#39). -
fpgpsp -ge(estimated pattern spectrum) samples item sets with fewer
instructions: the partial shuffle keeps the generator state in local
variables, the probabilities of a sample are sorted by insertion
instead ofslices.Sort(which still sorts samples of more than 256
items, where insertion sort would be slower), the array is no longer reversed physically
(the next shuffle works from the back and both order probabilities
are computed in one pass), andlog(c)of the support loop comes
from a table. The random numbers, swap indices,math.Logarguments
and floating-point operations are the same, so the output is
unchanged (and byte-identical to the C oracle's on every row and
differential case checked). Against main
(instructions retired, Apple M1 Max): 20,000 sparse transactions
-22 % (1.38 times the C oracle's instructions, 1.77 before), a
4,000 x 40 dense data set -37 % (1.13 times, 1.80 before), a
5,000 x 10 table -40 % (1.22 times, 2.04 before); the other methods
are unchanged. Seedocs/reviews/post-v0.1.0/issue-47-design.md
(#47). -
fpgrowthandfpgpspread and prepare the transaction database with
about a third of the instructions. They read the input once if its
records fit into 128 MiB (4 bytes per item occurrence and per record,
about 32 MB for a 16 MB table): the item base keeps the counted records
and builds the transaction bag from them, as upstream builds its bag
from the records it read; a larger input is read a second time as
before. Pass 1 looks every item name up once instead of twice
(tract.CountBytesovertabread.ScanBytes), and the table reader
returns fields that lie inside its 64 KiB block as views of it and
reads the common field (plain bytes and a separator) on a fast path.
Against main (instructions retired, Apple M1 Max) on 20,000 sparse
transactions replicated 30 times (16 MB), where reading and preparing
is almost the whole run:fpgrowth -s506.31G to 2.20G (C 1.43G),
fpgpsp -ge -z17.10G to 2.89G (C 1.71G); user time 0.45 s to 0.18 s
(C 0.14 s). Above the budget (the same data 300 times, 160 MB):
62.9G to 44.6G (C 14.3G). Mining rows gain 1 % to 49 %. Maximum
resident memory offpgrowthgrows by the retained records (B×30:
6 MB to 24 MB, C 44 MB; at most about the budget, 135 MB on B×300);
the records are collected as soon as they are released, sofpgpsp,
whose later structures are larger, peaks as before. Within the budget the programs no longer report an input file
that changes between the passes ("input changed while reading"): like
upstream, they use what they read. The output is byte-identical (#48). -
Above the 128 MiB budget, the second read of the input by
fpgrowth
andfpgpsplooks the item names up as byte slices, like the first,
instead of converting every name to a string (tract.BuildBagBytes;
fpgpsp -gsstill reads its records through the string scan).
On 195 MB of sparse transactions (instructions retired, Apple M1 Max):
fpgrowth -s5053.4G to 44.4G (C 17.0G),fpgpsp -ge -z161.9G to
52.9G (C 19.9G); user time 4.1 s to 3.4 s. Inputs within the budget,
peak memory and the output are unchanged (#52). -
Frequent item sets and generators with a small maximum size (
-n,
MaxSize) no longer take quadratic time on long single paths. Perfect
extensions that cannot change any result are skipped: a chain item of
a set that already has the maximum number of items no longer collects
its predecessors as perfect extensions, and the perfect extensions of
such a set (also those inherited from smaller sets, and those of the
empty set's hypercube) are no longer expanded only to be rejected
against the size limit. The audit's T4 input (17 lines of a 12,500-item
chain plus 12,510 one-item lines,-s-17 -n1) now takes 0.50 G
instead of 7.93 G instructions (C: 5.01 G) and grows linearly; one
line of 12,500 items with-s-1 -n10.15 G instead of 2.11 G (C: 1.91 G). The
output is unchanged; closed and maximal item sets are not affected
(#21, audit NEW-1). -
Closed item sets wi...
v0.1.0
First public version. A pure Go port and further
development of Christian Borgelt's FP-Growth 6.21 (2022-11-22) C
implementation.
Added
- Library package
fpgrowth(github.com/dimchansky/fpgrowth-go): pure
Go, no cgo, no dependencies outside the standard library; Go 1.26 or
later.- Targets: frequent, closed and maximal item sets, generators, and
association rules with a single-item head. - Generic items (any
comparabletype) and replayable sources:
FromItems,FromSlice,Generate,TableFile,TableReader,
CSVFile,CSVReader, andSpoolTable/SpoolCSVfor one-shot
readers. - Three delivery styles for each result kind: iterators (
Itemsets,
Rules), callbacks (MineItemsets,MineRules) and collectors
(CollectItemsets,CollectRules); early stop and cancellation
throughcontext.Context. - Upstream's algorithm variants (
Algorithm) and optimizations
(Tuning), absolute and relative support thresholds (Count,
Fraction), size limits, a per-size support border, transaction
weights, item selection, rule item appearances, 25 rule evaluation
measures with aggregation for item sets,Stats,Summaryand the
pattern spectrum. - Option validation with
ErrInvalidOptionsnaming the field
(including a non-zeroTableFormatwithout record separators, a
nilSourceFunc, and a maximum support below the minimum of the
same kind;SpoolTable/SpoolCSVcheck the format before copying
any input); size limits reported asErrTooLarge. Callback errors
of any type, comparable or not, are returned unchanged. Valueis NaN when no evaluation measure is set; results are
deterministic for the same data, options and version, but their
order is not part of the compatibility promise.
- Targets: frequent, closed and maximal item sets, generators, and
- Command-line program
cmd/fpgrowth, compatible with upstream
fpgrowth6.21: same options, input and output formats, messages and
exit codes, apart from the documented differences below. Standard input
is spooled to a temporary file; SIGINT stops the run with exit status
130. - Development tooling in the nested module
reference/(not part of the
published module): the unmodified upstream sources with a SHA-256
manifest, a scripted C reference build (release, debug, sanitizer and
native variants), and a randomized differential test suite against the
C program with a brute-force checker. - Golden fixtures produced by the C reference (plus Go output snapshots
for the documented differences), property tests against a brute-force
oracle, and fuzz targets for the table reader, the C number
parsers, the transaction bag, the miner, the CSV source and the CLI
option parser. - Benchmarks of the library and the CLI against the C reference
(docs/benchmarks.md). - CI (tests on Linux, macOS and Windows with Go 1.26 and 1.27, race
detector, static analysis, vulnerability scan, fuzz smoke tests,
differential tests) and GoReleaser-based release automation.
Differences from upstream
Every difference is intentional and listed with its kind (upstream
defect fix, platform difference, improvement, new or preserved behavior),
evidence and tests in
docs/differences.md;
they fix 33 distinct, confirmed upstream defects and avoid 2 upstream
crashes. In summary:
- Fixed mining results:
-Atcrashes or wrong item names (M1),-s0and
zero-frequency items (M2), generators missed with-m ≥ 2(M3), maximal
sets missed (M4, M9), non-closed or non-maximal sets with-n(M5).
Negative weights are rejected (M6), supports are 64-bit with an
overflow check (M7), out-of-range thresholds are clamped (M8), a sort
recursion crash on long shared prefixes is avoided (M10), and item
counts saturate instead of overflowing (M11). - Rules and evaluation:
-ebselects the imbalance ratio for rules (R1),
-pprunes as documented (R2), head-only items stay out of rule bodies
(R3),-Sapplies to the same support as-s(R8), and measure edge
cases are corrected (R4-R7, R9, R11; R9c and R11 are latent; R10 fixes the project's
patched C reference only). - Floating point: values are bit-identical to the C reference built
without fused multiply-add, except log-based values, which can differ in
the last bit from the platform's C library (F-1). - CLI output, input and messages:
-hand-gwork as documented, no
spurious empty-set line, count-only mode honors-n, write errors are
reported, escapes, non-ASCII separators, long fields and a last record
without a newline are handled, NaN thresholds are rejected, log times
are wall-clock times, a pre-formatting overflow crash is avoided
(O1-O11, I1-I8, C1-C10). - Numeric limits: the statistical rule measures lose precision at total
transaction weights above about 1e12, and thresholds tolerate rounding
above 2^52 (N1-N3). - Upstream behavior kept on purpose is listed as P1-P6.
Known limitations
- Statistical rule measures at very large total weights (audit
finding ALG-1,docs/differences.mdN1): chi², Yates, the G-test and
information, the Fisher tests, the certainty factor and-iare
computed in float64 as upstream does, and lose precision once the total
transaction weight exceeds about 10^12 (about 1–40 % error from
10^12–10^13, meaningless by 10^14–10^16). Item sets, supports,
confidence and the other measures are not affected. Exact arithmetic
would change the last bits of these values against the C reference on
ordinary data, so it is deferred to a future release.
Not included
- The
fpgpspprogram (fpgpsp.cis in the upstream archive, but the
modules it needs,tars.candpspest.c, are not) and
zlib-compressed output (-z, off in upstream's default build).
Verify a download: sha256sum --ignore-missing -c checksums.txt
(macOS: shasum -a 256 --ignore-missing -c checksums.txt), and its
build provenance: gh attestation verify <file> --repo dimchansky/fpgrowth-go --signer-workflow dimchansky/fpgrowth-go/.github/workflows/release.yml --source-ref refs/tags/v0.1.0 --deny-self-hosted-runners.
The library is installed with go get github.com/dimchansky/fpgrowth-go@v0.1.0.
v0.1.0-rc.2
First public version. A pure Go port and further
development of Christian Borgelt's FP-Growth 6.21 (2022-11-22) C
implementation.
Added
- Library package
fpgrowth(github.com/dimchansky/fpgrowth-go): pure
Go, no cgo, no dependencies outside the standard library; Go 1.26 or
later.- Targets: frequent, closed and maximal item sets, generators, and
association rules with a single-item head. - Generic items (any
comparabletype) and replayable sources:
FromItems,FromSlice,Generate,TableFile,TableReader,
CSVFile,CSVReader, andSpoolTable/SpoolCSVfor one-shot
readers. - Three delivery styles for each result kind: iterators (
Itemsets,
Rules), callbacks (MineItemsets,MineRules) and collectors
(CollectItemsets,CollectRules); early stop and cancellation
throughcontext.Context. - Upstream's algorithm variants (
Algorithm) and optimizations
(Tuning), absolute and relative support thresholds (Count,
Fraction), size limits, a per-size support border, transaction
weights, item selection, rule item appearances, 25 rule evaluation
measures with aggregation for item sets,Stats,Summaryand the
pattern spectrum. - Option validation with
ErrInvalidOptionsnaming the field
(including a non-zeroTableFormatwithout record separators, a
nilSourceFunc, and a maximum support below the minimum of the
same kind;SpoolTable/SpoolCSVcheck the format before copying
any input); size limits reported asErrTooLarge. Callback errors
of any type, comparable or not, are returned unchanged. Valueis NaN when no evaluation measure is set; results are
deterministic for the same data, options and version, but their
order is not part of the compatibility promise.
- Targets: frequent, closed and maximal item sets, generators, and
- Command-line program
cmd/fpgrowth, compatible with upstream
fpgrowth6.21: same options, input and output formats, messages and
exit codes, apart from the documented differences below. Standard input
is spooled to a temporary file; SIGINT stops the run with exit status
130. - Development tooling in the nested module
reference/(not part of the
published module): the unmodified upstream sources with a SHA-256
manifest, a scripted C reference build (release, debug, sanitizer and
native variants), and a randomized differential test suite against the
C program with a brute-force checker. - Golden fixtures produced by the C reference (plus Go output snapshots
for the documented differences), property tests against a brute-force
oracle, and fuzz targets for the table reader, the C number
parsers, the transaction bag, the miner, the CSV source and the CLI
option parser. - Benchmarks of the library and the CLI against the C reference
(docs/benchmarks.md). - CI (tests on Linux, macOS and Windows with Go 1.26 and 1.27, race
detector, static analysis, vulnerability scan, fuzz smoke tests,
differential tests) and GoReleaser-based release automation.
Differences from upstream
Every difference is intentional and listed with its kind (upstream
defect fix, platform difference, improvement, new or preserved behavior),
evidence and tests in
docs/differences.md;
they fix 33 distinct, confirmed upstream defects and avoid 2 upstream
crashes. In summary:
- Fixed mining results:
-Atcrashes or wrong item names (M1),-s0and
zero-frequency items (M2), generators missed with-m ≥ 2(M3), maximal
sets missed (M4, M9), non-closed or non-maximal sets with-n(M5).
Negative weights are rejected (M6), supports are 64-bit with an
overflow check (M7), out-of-range thresholds are clamped (M8), a sort
recursion crash on long shared prefixes is avoided (M10), and item
counts saturate instead of overflowing (M11). - Rules and evaluation:
-ebselects the imbalance ratio for rules (R1),
-pprunes as documented (R2), head-only items stay out of rule bodies
(R3),-Sapplies to the same support as-s(R8), and measure edge
cases are corrected (R4-R7, R9, R11; R9c and R11 are latent; R10 fixes the project's
patched C reference only). - Floating point: values are bit-identical to the C reference built
without fused multiply-add, except log-based values, which can differ in
the last bit from the platform's C library (F-1). - CLI output, input and messages:
-hand-gwork as documented, no
spurious empty-set line, count-only mode honors-n, write errors are
reported, escapes, non-ASCII separators, long fields and a last record
without a newline are handled, NaN thresholds are rejected, log times
are wall-clock times, a pre-formatting overflow crash is avoided
(O1-O11, I1-I8, C1-C10). - Numeric limits: the statistical rule measures lose precision at total
transaction weights above about 1e12, and thresholds tolerate rounding
above 2^52 (N1-N3). - Upstream behavior kept on purpose is listed as P1-P6.
Known limitations
- Statistical rule measures at very large total weights (audit
finding ALG-1,docs/differences.mdN1): chi², Yates, the G-test and
information, the Fisher tests, the certainty factor and-iare
computed in float64 as upstream does, and lose precision once the total
transaction weight exceeds about 10^12 (about 1–40 % error from
10^12–10^13, meaningless by 10^14–10^16). Item sets, supports,
confidence and the other measures are not affected. Exact arithmetic
is not used yet because it would change the last bits of these values
against the C reference on ordinary data; whether to implement it is
decided before the final release.
Not included
- The
fpgpspprogram (fpgpsp.cis in the upstream archive, but the
modules it needs,tars.candpspest.c, are not) and
zlib-compressed output (-z, off in upstream's default build).
Verify a download: sha256sum --ignore-missing -c checksums.txt
(macOS: shasum -a 256 --ignore-missing -c checksums.txt), and its
build provenance: gh attestation verify <file> --repo dimchansky/fpgrowth-go --signer-workflow dimchansky/fpgrowth-go/.github/workflows/release.yml --source-ref refs/tags/v0.1.0-rc.2 --deny-self-hosted-runners.
The library is installed with go get github.com/dimchansky/fpgrowth-go@v0.1.0-rc.2.
v0.1.0-rc.1
Verify a download: sha256sum --ignore-missing -c checksums.txt
(macOS: shasum -a 256 --ignore-missing -c checksums.txt), and its
build provenance: gh attestation verify <file> --repo dimchansky/fpgrowth-go --signer-workflow dimchansky/fpgrowth-go/.github/workflows/release.yml --source-ref refs/tags/v0.1.0-rc.1 --deny-self-hosted-runners.
The library is installed with go get github.com/dimchansky/fpgrowth-go@v0.1.0-rc.1.