mabwiser icon indicating copy to clipboard operation
mabwiser copied to clipboard

[Bug] Contextual models bug when using random_indices results in empty context

Open tk-MF opened this issue 1 year ago • 0 comments

Line 242 of mabwiser.linear.py

arm_expectations[nonrandom_indices] = np.array([self.arm_to_model[arm].predict(nonrandom_context) for arm in arms]).T

if there is an epsilon > 0, and low numbers of context provided can result in nonrandom_indices being empty and therefore the predict method results in an error.

A simple fix would be to add "if len(nonrandom_context):" in the preceeding line.

tk-MF avatar Oct 25 '24 12:10 tk-MF