Changing parameters during Thompson sampling

231 Views Asked by At

Thompson sampling uses a Beta probability distribution to sample parameters. After each sample, the distribution is changed, according to the sample value got.

Currently I am doing the following :

dist = new BetaDistribution(alpha, beta);
"sample"
"find new params"
dist = new BetaDistribution(alphaNew, betaNew);

Is there a way I can do it without having to create a new beta distribution every time I change the params? (I feel this may be inefficient)

I found that there had been setalpha() and setBeta() methods, which would allow to change the distribution, without creating a new one. But, these methods are now deprecated.

1

There are 1 best solutions below

0
On

The distribution types are designed to be thread-safe without the need for extra concurrency constructs. The major way this is accomplished is by making distribution instances immutable. Hence, the distribution parameters cannot be modified.

So, in order to get a Beta distribution instance with different parameters, a new instance must be created.