Skip to content

Add automatic source weighting for multisource estimation - #10

Open
Jodielidada wants to merge 2 commits into
mainfrom
automatic-source-weights
Open

Jodielidada wants to merge 2 commits into
mainfrom
automatic-source-weights

Conversation

@Jodielidada

@Jodielidada Jodielidada commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Multisource fitting currently uses equal weights when none are supplied. This change makes automatic source weighting the default in learner(), dlearner() and cv.learner(), using the inverse subspace-distance rule in Equation (3) of McGrath et al. (2026). Numeric weights remain supported; "equal" or explicit NULL retains equal weighting.

Implementation

  • Compute the sum of squared column- and row-projector distances using thin SVD bases, then normalize inverse distances with a 1e-12 stabilizer matching the paper repository's simulation helper.
  • Estimate automatic weights separately from each CV fold's training entries, keeping them fixed across that fold's penalty candidates. Return both fold weights and full-observed-data weights for the final refit.
  • Return the weighting method and normalized weights with fitted estimates. Add documentation and a runnable automatic-weight CV/refit example.

Choices for review

Automatic weighting is the new default when the argument is omitted. For an incomplete target, including CV training targets, a zero-filled target SVD supplies the pilot subspaces used for weighting. This is an extension of the complete-data formula; missing entries remain excluded from the fitting loss. The pilot may be sensitive to structured missingness. The default change and this missing-data treatment are the main decisions to review before merging.

Validation

Tests cover explicit-projector agreement, coincident and orthogonal spaces, full rank, manual/equal modes, and independent fold-by-fold CV predictions. A held-out-value perturbation test verifies that validation values do not affect their fold's weights. Existing single-source and fixed-weight numerical regressions remain covered.

The implementation passed the full local test suite and R CMD check --no-manual with the rendered vignette in the development checkout. The full test suite also passed on this branch against the latest main. Local OpenMP support is unavailable, so true multithreaded execution remains for CI to exercise.

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.23%. Comparing base (9bc6dc5) to head (da14986).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #10      +/-   ##
==========================================
+ Coverage   99.18%   99.23%   +0.05%     
==========================================
  Files           7        7              
  Lines         610      657      +47     
==========================================
+ Hits          605      652      +47     
  Misses          5        5              

☔ 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.

@Jodielidada
Jodielidada requested a review from stmcg November 16, 2026 23:39
@Jodielidada
Jodielidada marked this pull request as ready for review November 16, 2026 23:39
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