stom-regret-function" class="anchor"></a>How do I define my own custom regret function?</h2>
<p>In the <code>get_reward()</code> function of a <code>Bandit</code> you can set both the <code>reward</code>, and the <code>optimal reward</code>.</p>
<p>When both have been set, <code>contextual</code> then knows to subtract the former from the latter to obtain the <code>regret</code>.</p>
<p>For example, see <code>BasicBernoulliBandit</code>’s implementation:</p>
<div class="sourceCode" id="cb5"><html><body><p