Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

The NullHyperparameterLikelihood class lacked test coverage for its core behaviors: variance calculation consistency with the parent class and threshold enforcement for rejecting high-variance samples.

Changes

Added NullHyperparameterLikelihoodTests test class with three tests:

  • test_null_likelihood_variance_matches_hyperparameter_likelihood: Verifies variance calculation matches parent HyperparameterLikelihood exactly
  • test_null_likelihood_returns_zero: Confirms likelihood always returns 0.0 regardless of parameters
  • test_null_likelihood_returns_neginf_when_variance_exceeds_threshold: Validates that log_likelihood_ratio() returns -inf when variance exceeds maximum_uncertainty threshold
# Example: Variance matching test
null_like = NullHyperparameterLikelihood(posteriors=data, hyper_prior=model)
hyper_like = HyperparameterLikelihood(posteriors=data, hyper_prior=model)

null_ln_l, null_variance = null_like.ln_likelihood_and_variance(params)
hyper_ln_l, hyper_variance = hyper_like.ln_likelihood_and_variance(params)

assert null_ln_l == 0.0  # Null likelihood always zero
assert null_variance == hyper_variance  # But variance matches parent

Tests follow existing patterns in likelihood_test.py and integrate with the existing 22-test suite.

Original prompt

Add a test for the NullHyperparmeterLikelihood testing that the variance matches the HyperparameterLikelihood and returns zero for the likelihood when the variance is less than the threshold.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 15, 2025 15:04
Co-authored-by: ColmTalbot <25602909+ColmTalbot@users.noreply.github.com>
Co-authored-by: ColmTalbot <25602909+ColmTalbot@users.noreply.github.com>
Copilot AI changed the title [WIP] Add test for NullHyperparameterLikelihood variance and likelihood Add tests for NullHyperparameterLikelihood variance and threshold behavior Dec 15, 2025
Copilot AI requested a review from ColmTalbot December 15, 2025 15:08
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.64%. Comparing base (ba7ab69) to head (f339226).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #133      +/-   ##
==========================================
+ Coverage   88.42%   88.64%   +0.22%     
==========================================
  Files          14       14              
  Lines         907      907              
==========================================
+ Hits          802      804       +2     
+ Misses        105      103       -2     
Flag Coverage Δ
python3.10 88.64% <ø> (+0.22%) ⬆️
python3.11 88.64% <ø> (+0.22%) ⬆️
python3.12 88.64% <ø> (+0.22%) ⬆️
python3.13 88.64% <ø> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@ColmTalbot ColmTalbot marked this pull request as ready for review December 15, 2025 15:15
@ColmTalbot ColmTalbot merged commit bf5e40a into main Dec 15, 2025
16 checks passed
@ColmTalbot ColmTalbot deleted the copilot/add-test-null-hyperparameter-likelihood branch December 15, 2025 15:16
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