---

title: Epsilon


keywords: fastai
sidebar: home_sidebar

summary: "ϵ-greedy algorithmic modules."
description: "ϵ-greedy algorithmic modules."
nb_path: "nbs/models/epsilon.ipynb"
---
<!--

#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: nbs/models/epsilon.ipynb
# command to build the docs after a change: nbdev_build_docs

-->

<div class="container" id="notebook-container">
        
    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h2 id="EpsilonGreedy" class="doc_header"><code>class</code> <code>EpsilonGreedy</code><a href="https://github.com/RecoHut-Projects/recohut/tree/master/recohut/models/epsilon.py#L15" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>EpsilonGreedy</code>(<strong><code>epsilon</code></strong>:<code>float</code>=<em><code>0.2</code></em>, <strong><code>batch_size</code></strong>:<code>int</code>=<em><code>1000</code></em>)</p>
</blockquote>
<p>Class that is used to run a Epsilon-greedy multi-armed bandits test.
Attributes:
    epsilon: Percentage of exploration.
    batch_size: Number of examples per batch.</p>
<p>Methods:
    add_bandit: Adds a new BetaBandit to the test.
    update_bandit: Updates the priors of the BetaBandit at index idx.
    add_best_bandit: Adds the best bandit of the current batch.
    bandit_batch: Determines how many times each bandit gets used in the running batch.</p>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h2 id="EpsilonGreedyRunner" class="doc_header"><code>class</code> <code>EpsilonGreedyRunner</code><a href="https://github.com/RecoHut-Projects/recohut/tree/master/recohut/models/epsilon.py#L90" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>EpsilonGreedyRunner</code>(<strong><code>bandit_returns</code></strong>:<code>List</code>[<code>float</code>], <strong><code>epsilon</code></strong>:<code>float</code>=<em><code>0.2</code></em>, <strong><code>batch_size</code></strong>:<code>int</code>=<em><code>10000</code></em>, <strong><code>batches</code></strong>:<code>int</code>=<em><code>10</code></em>, <strong><code>simulations</code></strong>:<code>int</code>=<em><code>100</code></em>)</p>
</blockquote>
<p>Class that is used to run simulations of Thompson sampling tests.
Attributes:
    bandit_returns: List of average returns per bandit.
    epsilon: Percentage of exploration.
    batch_size: Number of examples per batch.
    batches: Number of batches.
    simulations: Number of simulations.</p>
<p>Methods:
    init_bandits: Prepares everything for new simulation.
    run: Runs the simulations and tracks performance.</p>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

</div>
 

