Thompson sampling: Precise arm-pull dynamics and adaptive inference