Skip to content

Add dig_itemsets() with dedicated R/C++ mining path and docs/tests wiring - #54

Merged
beerda merged 3 commits into
develfrom
copilot/create-dig-itemsets-function
Sep 7, 2026
Merged

Add dig_itemsets() with dedicated R/C++ mining path and docs/tests wiring#54
beerda merged 3 commits into
develfrom
copilot/create-dig-itemsets-function

Conversation

Copilot AI commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

This PR adds first-class itemset mining alongside existing association-rule mining by introducing dig_itemsets() and routing it through a dedicated C++ storage/dispatch path. It mirrors the dig_associations() digging flow where appropriate, with itemset-specific API shape and outputs.

  • R API: new dig_itemsets() surface

    • Added R/dig_itemsets.R with itemset-oriented arguments (items instead of antecedent; no consequent, min_coverage, min_confidence, contingency_table, threads).
    • Reuses .dig() pipeline with call_function = "dig_itemsets" and itemset semantics (focus = c(), filter_empty_foci = FALSE).
    • Returns nugget flavour itemsets with call metadata aligned to existing digger APIs.
  • Dispatcher integration (.dig + Rcpp entrypoints)

    • Extended .dig() dispatch in R/dig.R to handle call_function == "dig_itemsets" and call dig_itemsets_().
    • Added new exported C++ entrypoint dig_itemsets_ in src/dig.cpp.
    • Wired generated interface layers in R/RcppExports.R and src/RcppExports.cpp.
  • C++ storage specialization for itemsets

    • Added src/dig/ItemsetStorage.h, modeled after AssocStorage, but storing itemsets as:
      • items (formatted set)
      • support
      • count
      • length
    • Added DigItemsetRunner in src/dig.cpp to dispatch over the same chain-type strategy as other dig variants.
  • Tests and package docs index updates

    • Added tests/testthat/test-dig_itemsets.R with basic output, max_results limiting, and argument validation coverage.
    • Exported symbol in NAMESPACE.
    • Added dig_itemsets to _pkgdown.yml reference index.

Example usage:

d <- partition(mtcars, .breaks = 2)

res <- dig_itemsets(
    d,
    items = everything(),
    min_support = 0.3
)

Co-authored-by: beerda <26056018+beerda@users.noreply.github.com>
@beerda
beerda merged commit cb537a4 into devel Sep 7, 2026
1 of 6 checks passed
@beerda
beerda deleted the copilot/create-dig-itemsets-function branch September 7, 2026 11:50
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.37500% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.75%. Comparing base (e7acebd) to head (82ce857).
⚠️ Report is 2 commits behind head on devel.

Files with missing lines Patch % Lines
src/dig/ItemsetStorage.h 65.71% 24 Missing ⚠️
R/dig_itemsets.R 98.64% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel      #54      +/-   ##
==========================================
- Coverage   86.86%   86.75%   -0.11%     
==========================================
  Files         127      129       +2     
  Lines        6516     6676     +160     
==========================================
+ Hits         5660     5792     +132     
- Misses        856      884      +28     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants