Skip to content

【代码贡献】完善 QARM 高阶关联规则枚举 - #55

Open
woahwhattheheck wants to merge 1 commit into
OriginQ:developfrom
woahwhattheheck:origin-cup/qarm-complete-rules-20260908-sol-01
Open

【代码贡献】完善 QARM 高阶关联规则枚举#55
woahwhattheheck wants to merge 1 commit into
OriginQ:developfrom
woahwhattheheck:origin-cup/qarm-complete-rules-20260908-sol-01

Conversation

@woahwhattheheck

Copy link
Copy Markdown

Summary

Related to #13.

QARM currently derives confidence rules by comparing each frequent k-itemset only with frequent (k-1)-itemsets. For a frequent 3-itemset such as {A,B,C}, that emits the 2→1 rules but misses valid 1→2 rules such as A->B,C.

This contribution keeps the existing quantum frequent-itemset search unchanged and extends only association-rule enumeration:

  • enumerate every non-empty proper subset of each frequent itemset as a possible antecedent;
  • reuse the already-computed frequent-itemset support table for confidence;
  • preserve the existing two-decimal confidence semantics and public dict result shape;
  • sort antecedent/consequent item ids when formatting rule keys so output is deterministic;
  • expose the enhanced implementation through the existing pyqpanda_alg.QARM.QuantumAssociationRulesMining package API while retaining the original QARM implementation as the base class.

Validation

Focused deterministic fixture validation covers all 12 expected rules across frequent 2- and 3-itemsets, higher-order rules under a confidence threshold, and deterministic key formatting for unordered sets. Syntax compilation also passes. The current local runtime does not include pyqpanda3, so I am not claiming a full native repository test run; fork-hosted validation is queued and maintainer CI remains authoritative.

This scope is intentionally separate from #50: that PR changes QARM search correctness in qarm.py and explicitly leaves higher-order _get_all_conf() rule enumeration unresolved. The paths are disjoint, and this subclass composes on top of the base QARM implementation.

Base develop: 5f973efccb84bc193157d1ccebe32137e307293b. Exact head: c74d9273bdd87d4e9aacacceb25cf155c9d8dbc8. Diff: 3 paths, +111/-1.

Prepared with AI assistance for TokenJunkieLabs; operated by @woahwhattheheck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant