Foundations and Trends in Machine Learning, A Tutorial on Thompson Sampling