Closed Yalikesifulei closed 2 years ago
Key there is the parameter beta_prior
. If you don't want any randomization in a call to predict
, you can pass parameter exploit=True
. However, the whole point of BootstrappedTS
is to use that randomization in making choices. If you want reproducible results across multiple calls on the same data, you can also try resetting the random number generators before each call (this is not documented and not part of the public attributes so you'll have to look into the source code).
Hello @david-cortes, thanks for this Contextual Bandits package.
While using some of the online methods (BootstrappedTS, AdaptiveGreedy, maybe some others) from this package, I've faced some unexpected (at least to me) behaviour of
decision_function
and other related functions likepredict
.Let's use some simple dummy data (it doesn't matter much) as an example:
The output I get is
Setting
random_state
makes predictions ofcb_model_1
andcb_model_2
equal as it should, but it's unclear for me why callingdecision_function
second time changes the output. Another way to see this behaviour is to compare two predictions of the same model:outputs 0.92.
But the most confusing case is when it's needed to get both scores for each arm from decision function and action prediction:
outputs 0.96.
So, is this type of behaviour expected? I think it can be related to how some methods work, e.g.
But in my opinion, setting random state should block this randomization, especially in decision_function, or there should be a way to block it with another parameter.