EngineBuilder.add_adaptation()#
- EngineBuilder.add_adaptation(duration, init=0.1, term=0.2, base=25, thinning=1)[source]#
Adds adaptation epochs, for tuning kernel hyperparameters.
This follows the Stan Development Team (Stan Reference Manual 2021, Chapter 15.2 [1]).
Note that the order in which you add epochs matters. Adaptation epochs should usually come before all other epochs.
- Parameters:
duration (
int) – The number of adaptation samples.init (
float|int, default:0.1) – The share of samples in the initial fast adaptation epoch, relative to the total number of adaptation samples (if given as a float), or the total number of init samples (if given as an integer).term (
float|int, default:0.2) – The share of samples in the final fast adaptation epoch, relative to the total number of adaptation samples (if given as a float), or the total number of term samples (if given as an integer).base (
int, default:25) – The number of samples in the first slow adaptation epoch.thinning (
int, default:1) – Thinning applied in each adaptation.
Warning
Kernels which rely on history tuning might not be able to deal with thinning during adaptation.
See also
add_posteriorFor adding posterior epochs.
add_burninFor adding burnin epochs.
add_adaptationFor adding adaptation epochs.
set_durationAn alternative method to specify adaptation and posterior epochs, see notes for details.
Notes
There are some differences in the details between the methods
add_posterior(),add_adaptation(),add_burnin()andset_duration().set_duration()overwrites all existing epochs with the epochs defined in this method. In contrast, theadd_methods only add additional epochs that are appended to the potentially existing ones.set_duration()sets both adaptation and posterior epochs, while eachadd_method only adds epochs of one type.set_duration()has an argumentterm_durationthat defines the number of samples drawn in the final fast adaptation epoch, and it defaults to a fixed value of 50 samples. In contrast,add_adaptation()defines the number of samples drawn in the final fast adaptation epoch as a fraction of the total number of adaptation samples, and allows users to change this fraction via the argumentterm. As a result, ifadd_adaptation()is used, the length of the final fast adaptation phase increases automatically, if the total number of warmup samples increases, while it remains constant ifset_duration()is used.
References