Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .travis/test-integrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,50 @@ if [ "$_E2E_BAD" -ne 0 ]; then
exit 1
fi

# mcsamplerNFlow as a mcsamplerPortfolio MEMBER. --sampler-portfolio NFlow is offered
# by both util_ConstructIntrinsicPosterior_GenericCoordinates and
# util_ConstructEOSPosterior, and the configuration could not run. Four defects:
#
# * draw_simplified() returned (rv, p_s, p_prior) while MCSamplerGeneric and every
# other implementation return (p_s, p_prior, rv), which is what
# mcsamplerPortfolio.draw() unpacks -- so the SAMPLES were assigned to joint_p_s.
# Not reliably loud: on [AV, NFlow] over a unit Gaussian, d=2 raised a broadcast
# ValueError but d=1 COMPLETED, 3.07 nats low.
# * no sampling_density(), which the portfolio needs for q_mix -- and since the
# member p_s contract landed, [AV, NFlow] is refused outright at setup().
# * enforce_bounds discarded the out-of-box flow samples without refilling, so a
# trained flow returned FEWER samples than asked and the portfolio aborted
# copying into its fixed-width slice; and the p_s it reported was the undivided
# q(x) rather than q(x)/A, biasing its own evidence high by ln(1/A).
# * num_layers = int(d/2) is 0 at d=1, so a one-parameter flow had no trainable
# weights and training died in torch.
#
# Runs in CI although test_NF_reuse.py is rostered OPTDEP: the paths pinned here are
# the untrained uniform branch plus strict in-file flow stand-ins, and the file stubs
# torch/nflows at import when they are absent (and uses the real packages when
# present, which is how the trained-flow arithmetic was checked -- see the PR).
_NFCONTRACT_TESTS=MonteCarloMarginalizeCode/Code/test/integrators/test_NFlow_portfolio_contract.py
_NFCONTRACT_EXPECTED=21
_NFCONTRACT_FOUND=$(python -m pytest -q --collect-only "$_NFCONTRACT_TESTS" 2>/dev/null | grep -c '::' || true)
if [ "$_NFCONTRACT_FOUND" -ne "$_NFCONTRACT_EXPECTED" ]; then
echo "NFlow portfolio-contract gate: collected $_NFCONTRACT_FOUND tests, expected $_NFCONTRACT_EXPECTED" >&2
exit 1
fi
# PASSED FLOOR, not just the collection count. Nothing in this file skips, and the
# count above already catches a deleted test -- but an xfail(run=False) changes
# neither the collection count nor the exit code and prints no SKIPPED line, so the
# number that actually RAN is the only thing that can see it.
_NFCONTRACT_OUT=$(python -m pytest -q "$_NFCONTRACT_TESTS" 2>&1 | tee >(cat >&2)) \
|| { echo "NFlow portfolio-contract gate FAILED" >&2; exit 1; }
# grep, not sed with a leading .*[^0-9]: pytest's summary is "12 passed, 2 warnings in
# 6.48s", with the count at the START of the line, so a pattern needing a character
# before it matched nothing and scored 0 passed on a fully green run.
_NFCONTRACT_PASSED=$(printf '%s\n' "$_NFCONTRACT_OUT" | grep -oE '[0-9]+ passed' | tail -1 | grep -oE '^[0-9]+')
if [ "${_NFCONTRACT_PASSED:-0}" -ne "$_NFCONTRACT_EXPECTED" ]; then
echo "NFlow portfolio-contract gate: $_NFCONTRACT_EXPECTED collected but ${_NFCONTRACT_PASSED:-0} passed (xfail/skip would not change the exit code)" >&2
exit 1
fi

# Supplementary-likelihood plugin hook: the NAL reader/evaluator (pure numpy, no data) and the
# static guard on the drivers' prepare-hook wiring, which is what makes the plugin receive the
# SAMPLING basis at all. Both are seconds-long and protect a silent-wrong-answer path.
Expand Down
Loading
Loading