oadr_cpep.aggregate module

Aggregator steps: build the consensus feature set and combine the per-site coefficient vectors / forests.

consensus_features : Phase 1 — multi-site tally, or one site’s selection (–from-site). aggregate_vectors : Phase 2 — FedAvg / median / mean of the vectors + union of forests.

Both take their inputs as EXPLICIT files (no directory, no glob). Each vector / selection file carries its own provenance columns (panel, features_source, site), so the output naming and the solo-vs-federated mode are derived from the files themselves — panels / feature sources are never mixed (that is an error).

Only site-level parameters (feature lists, coefficient vectors, forests) are read.

oadr_cpep.aggregate.consensus_features(features, min_sites=None, from_site=None, outdir='.')[source]

Tally the given per-site selected-features CSVs into a consensus feature set.

Parameters:
  • features – list of explicit *_selected_features.csv file paths.

  • min_sites – keep a feature selected by >= this many sites (default: majority).

  • from_site – use this site’s selection AS the consensus (single-site, bespoke).

  • outdir – output directory.

oadr_cpep.aggregate.aggregate_vectors(vectors, method='fedavg', outdir='.')[source]

Combine the given per-site coefficient vectors / forests.

Parameters:
  • vectors – list of explicit per-site files — coefficient vector CSVs and/or RF .pkl forests (each is dispatched by type). Panel and feature source are read from the files and must be consistent.

  • method – vector combine rule — fedavg (weighted by n_subjects), median, mean.

  • outdir – output directory.