Make operator target acceptance probability configurable; bump 1-D defaults to 0.3#71
Merged
Merged
Conversation
Add a 'targetAcceptanceProbability' Input on the Operator base class. When set, it overrides the operator's default target. The default is now resolved through a new getDefaultTargetAcceptanceProbability() method (returns 0.234 in the base class). Subclasses that previously overrode getTargetAcceptanceProbability() now override getDefaultTargetAcceptanceProbability() instead, so the XML input applies uniformly across all operators. Adjust per-operator defaults: - 1-D operators that inherited the 0.234 default now return 0.3: SubtreeSlide, BactrianSubtreeSlide, ScaleOperator, TipDatesScaler, TipDatesRandomWalker (BactrianTipDatesRandomWalker inherits via its parent), RealRandomWalkOperator (inference), DeltaExchangeOperator (inference). - BactrianUpDownOperator and spec UpDownOperator no longer override; they inherit the 0.234 base default (multi-D, asymptotic target applies). Background: 0.234 is the asymptotic optimum for random-walk Metropolis in high dimension (Roberts, Gelman, Gilks 1997). For 1-D moves the optimum is closer to 0.44 (Gelman, Roberts, Gilks 1996; Roberts, Rosenthal 2001). A target of 0.3 is a conservative compromise. The previous 0.234 default for 1-D operators caused the auto-tuner to inflate step size on data where natural acceptance at small sizes already exceeded 0.234, after which the 1/n Robbins-Monro gain was too small to recover when steady-state acceptance fell well below target.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
targetAcceptanceProbabilityXML input on theOperatorbase class so users can override the auto-tune target per operator without code changes.Refactors the resolution path (input ->
getDefaultTargetAcceptanceProbability()-> base default) and migrates every existing override to the new method name.Adjusts a few defaults at the same time.
What changes
Base class (
Operator.java):Input<Double> targetAcceptanceProbabilityInput(defaultDouble.NaN, meaning "use operator default").getTargetAcceptanceProbability()now returns the input if set, otherwise callsgetDefaultTargetAcceptanceProbability().getDefaultTargetAcceptanceProbability()returning 0.234, which subclasses override.Migrated overrides (functionally equivalent, just renamed):
BactrianScaleOperator,BactrianNodeOperator,BactrianRandomWalkOperator,BactrianIntervalOperator,BactrianDeltaExchangeOperator,EpochFlexOperator,AdaptableVarianceMultivariateNormalOperator(legacy and spec, dropsfinal),IntervalScaleOperator(spec),AbstractScale(spec),RealRandomWalkOperator(spec),DeltaExchangeOperator(spec),IntervalOperator(spec).Default bumped 0.234 -> 0.3 (1-D operators that were inheriting the base default):
SubtreeSlide,BactrianSubtreeSlideScaleOperatorTipDatesScaler,TipDatesRandomWalker(BactrianTipDatesRandomWalkerinherits via its parent)RealRandomWalkOperator(legacy inference)DeltaExchangeOperator(legacy inference)Default reverted 0.3 -> 0.234 (multi-D operators that should use the asymptotic target):
BactrianUpDownOperator,UpDownOperator(spec).The legacy
inference/operator/UpDownOperator.javaalready inherited 0.234 and is unchanged.Operators with deliberate non-default values are kept (
EpochFlexOperator0.4) but renamed togetDefaultTargetAcceptanceProbability.Why
The 0.234 default comes from Roberts, Gelman, Gilks (1997) and is the asymptotic optimum for random-walk Metropolis as dimension increases.
For 1-D moves the optimum is closer to 0.44 (Gelman, Roberts, Gilks 1996; Roberts and Rosenthal 2001), so 0.234 is too low.
We observed this in practice on a real-data analysis: starting
BactrianSubtreeSlideatsize=0.002withoptimise="false"gave ~53% acceptance, but withoptimise="true"the auto-tuner repeatedly increased step size to drive acceptance toward 0.234, and after enough moves the 1/n Robbins-Monro gain became too small to walk the size back when steady-state acceptance fell to ~5%.A target of 0.3 is a conservative compromise that does not require the tuner to push as hard against the structural acceptance ceiling of these 1-D operators.
The XML input lets users override on a case-by-case basis without further code changes:
Test plan
mvn -pl beast-base -am compilecleanmvn compile(all modules) cleanmvn -pl beast-base test -Dtest='*Operator*Test'-> 20/20 passBactrianSubtreeSlideauto-tunes to a sensible step size