Expand description
Apriori-style frequent itemset mining + association-rule generation over
per-class callSequences blobs.
Each class node carries a callSequences JSON blob with shape
{"sequences": [{"method": str, "calls": [str], …}, …]}
Every sequence with len(calls) >= 2 becomes one transaction (the
frozenset of its calls). We then:
- Mine frequent itemsets by Apriori (bottom-up by k), capped at
k = 5to match the Python reference. - Generate rules
A → Cfor every non-empty proper subsetAof each frequent itemset, scoring withconfidence = sup(A∪C)/sup(A)andlift = confidence / (sup(C)/n). - Classify each rule as
invariant(conf ≥ 0.99),strong(≥ 0.85), ormoderate(≥ 0.5).
Mirrors analysis/association_rules.py in the visiting tool.
See DESIGN.md (Phase 3) at the workspace root.
Structs§
- Association
Analysis - Whole-graph association-rule readout.
- Association
Rule - An association rule
antecedent → consequentwith support, confidence, and lift. - Call
Sequence - One call-sequence record parsed from a class’s
callSequencesblob. - Frequent
Itemset - A frequent itemset and its support count across the transaction list.
Functions§
- classify_
rule - Classify by confidence threshold —
invariant(≥0.99),strong(≥0.85),moderateotherwise. - compute_
association_ analysis - Walk every node’s
callSequencesblob and run end-to-end mining. - generate_
rules - Generate association rules from frequent itemsets.
- mine_
frequent_ itemsets - Mine frequent itemsets by Apriori. Caps
kat 5 (matches Python ref) to keep candidate generation tractable on large unique-item alphabets. - parse_
call_ sequences - Parse the
{"sequences": [...]}blob attached to a single class.