Changelog
Source:NEWS.md
monecascale 0.5.0
New features
-
rr_from_duckdb()— build a sparse relative-risk matrix out of core via DuckDB SQL. Accepts edge-list input as a data.frame, a file path (.csv/.parquet), or a table name on a pre-connected DuckDB instance. Returns a"monecascale_rr"list with sparse$rr, sparse$counts, and margin / node-name metadata. Composes withmoneca_bipartite()(via$rr) andmoneca_sbm()/moneca_flow()(via$counts).
Dependencies
-
duckdb (>= 1.0.0)andDBI (>= 1.2.0)added toSuggests. The package degrades gracefully with an informative error when either is missing.
Documentation
- New vignette
monecascale-duckdbcovering the RR bottleneck, the SQL recipe, three input modes, and end-to-end composition with the existing clustering backends.
Limitations
-
moneca::moneca_segments()still densifiesmat.list[[1]]internally, so the full clustering pipeline retains an in-R memory ceiling around 10^5 nodes until a sparse-aware metadata path lands upstream in moneca. - No Arrow dataset input yet; planned follow-up.
monecascale 0.4.1
Bug fixes / completeness
-
auto_segment_levels()now supportsmoneca::moneca_fast()output with both criteria. Themethod = "mdl"branch scores each hierarchical level via weighted modularity on the core graph (igraph::modularity()); the score column in$diagnosticsis named"modularity"to reflect the scoring function honestly.method = "mi_plateau"works unchanged. This closes the deferred feature tracked as “0.3.1” in the 0.3.0 release notes.
monecascale 0.4.0
New features
-
moneca_flow()— D3 of the scaling roadmap. Flow-based hierarchical clustering via Infomap and the Map Equation. Single backend:igraph::cluster_infomap()(R-native, scales to ~10^5 nodes). A recursive-flat wrapper synthesises a 2–3 level hierarchy from the flat solution. Returns a plainmoneca-class object with$flow_diagnostics(codelength per level, node flow assignments). -
auto_segment_levels()now recognises flow-backend objects. The MDL criterion readscodelength_per_leveland reports acodelengthscore column per level.
Empirical validation
On a 4-block 60-node synthetic fixture (seed 2026): - flow: ARI = 1.000, NMI = 1.000
Documentation
- New vignette
monecascale-flowcovering the Map Equation, the flat-vs-hierarchical trade-off, and a comparison of flow recovery againstmoneca_sbm()on the same fixture.
monecascale 0.3.0
New features
-
auto_segment_levels()— D6 of the scaling roadmap. Post-hoc auto-selection of a hierarchy level from a fit, using either:-
method = "mdl"— MDL elbow via the kneedle algorithm (Satopää et al. 2011) ormax_second_difffallback. -
method = "mi_plateau"— level-to-level mutual information plateau, picking the level where marginal gain drops belowplateau_tolof the max MI.
-
-
segment.levels = "auto"wrapper onmoneca_sbm()andmoneca_bipartite()— fits the full hierarchy, callsauto_segment_levels()post-hoc, trimssegment.listandmat.listto the chosen level, and attaches$auto_levelwith diagnostics. - New
auto_methodargument on both backends, defaulting to"mdl". - Returns an S3
auto_segment_levelsobject with$level,$method,$diagnostics(per-levelmdl,mi_to_next,n_blocks,score),$backend, and$call. Includesprintandformatmethods.
Internals
-
R/bipartite_utils.R::.build_side_moneca()now stamps each bipartite side with$bipartite_originand a slim$bipartite_diagnostics_side, so detached sides can feedauto_segment_levels()without the parent object.
Coverage
- SBM and bipartite backends fully supported.
moneca_fast()output raises an explicit error pointing at the 0.3.1 roadmap — ex-post MDL reconstruction or an upstream bookkeeping PR to moneca is the open choice.
monecascale 0.2.0
New features
-
moneca_bipartite()— D1 of the scaling roadmap. Accepts rectangular person × employer (or worker × occupation, etc.) mobility matrices and returns an S3 object of class"moneca_bipartite"wrapping two linkedmoneca-class objects ($rows,$cols) plus a$bipartite_diagnosticsslot carrying the joint ICL/MDL trace, per-level block counts per side, rectangular RR, and per-levelKrow × Kcolblock-interaction matrices. - Single backend:
greed::DcLbm(hierarchical Poisson latent block model). Scales to ~104–105 rows / cols per side. - Output contract: each of
$rowsand$colsis consumable unchanged bymoneca::segment.membership(),moneca::segment.quality(),moneca::plot_moneca_ggraph(),moneca::plot_moneca_hierarchical().
Theoretical note
Rectangular RR = O / ((row · col) / total) is the DcLbm residual under identity block interaction, extending the RR ≡ DC-SBM bridge from D2. moneca_bipartite() fits DcLbm on scaled-rounded RR and projects each side via one-mode RR aggregation with D_other_margin^{-1} normalisation.
Empirical validation
On a 60 × 40 synthetic bipartite fixture with 3 latent row blocks and 2 latent col blocks (seed 2026): - rows: ARI = 0.563, NMI = 0.761 - cols: ARI = 1.000, NMI = 1.000
See tests/testthat/test-bipartite-parity.R.
monecascale 0.1.0
Initial release
Sibling package for moneca providing scalable clustering backends. Extracted from moneca branch new_directions on 2026-04-23.
Features
-
moneca_sbm()— hierarchical degree-corrected stochastic block model clustering as an alternative tomoneca::moneca_fast()’s clique enumeration. Two backends:-
"greed"(default, R-native viagreed::DcSbm): hierarchical dendrogram, Poisson likelihood, sparsedgCMatrixend-to-end, portable parallel via thefutureframework. Scales to ~104–105 nodes. -
"graphtool"(opt-in, Python viareticulate): Peixoto’sminimize_nested_blockmodel_dl()with automatic MDL-based level selection. Scales to 10^6+ nodes. Install viamoneca_sbm_install_graphtool().
-
- The output of
moneca_sbm()is a standardmoneca-class S3 object consumed unchanged bymoneca::segment.membership(),moneca::segment.quality(),moneca::plot_moneca_*()etc. An extra$sbm_diagnosticsslot records backend, MDL/ICL per level, and the number of blocks per level.
Theoretical rationale
moneca’s weight matrix RR = O / E is structurally the expected-value residual under a DC-SBM with identity block interaction. Consequence: moneca_fast() is approximately DC-SBM clustering done by clique enumeration on the thresholded residual, and modern DC-SBM inference (Peixoto’s graph-tool, greed) is a principled drop-in.
Empirical validation
On a 20-class synthetic fixture (generate_mobility_data(n_classes = 20, immobility_strength = 0.5, class_clustering = 0.75, seed = 2026)), the best-matching level pair between moneca_sbm(backend = "greed") and moneca::moneca_fast() reaches ARI = 0.671, NMI = 0.905 — above the 0.55 aspirational target.