---

title: Sampling


keywords: fastai
sidebar: home_sidebar

summary: "Data sampling methods."
description: "Data sampling methods."
nb_path: "nbs/transforms/transforms.sampling.ipynb"
---
<!--

#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: nbs/transforms/transforms.sampling.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 ">
<h4 id="simple_negative_sampling" class="doc_header"><code>simple_negative_sampling</code><a href="https://github.com/RecoHut-Projects/recohut/tree/master/recohut/transforms/sampling.py#L16" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>simple_negative_sampling</code>(<strong><code>data</code></strong>, <strong><code>num_negatives</code></strong>=<em><code>4</code></em>, <strong><code>binarization</code></strong>=<em><code>False</code></em>, <strong><code>feedback_column</code></strong>=<em><code>'RATING'</code></em>)</p>
</blockquote>

</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="AbstractNegativeSampler" class="doc_header"><code>class</code> <code>AbstractNegativeSampler</code><a href="https://github.com/RecoHut-Projects/recohut/tree/master/recohut/transforms/sampling.py#L50" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>AbstractNegativeSampler</code>(<strong><code>train</code></strong>, <strong><code>val</code></strong>, <strong><code>test</code></strong>, <strong><code>user_count</code></strong>, <strong><code>item_count</code></strong>, <strong><code>sample_size</code></strong>, <strong><code>seed</code></strong>, <strong><code>flag</code></strong>, <strong><code>save_folder</code></strong>)</p>
</blockquote>

</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="RandomNegativeSampler" class="doc_header"><code>class</code> <code>RandomNegativeSampler</code><a href="https://github.com/RecoHut-Projects/recohut/tree/master/recohut/transforms/sampling.py#L89" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>RandomNegativeSampler</code>(<strong><code>train</code></strong>, <strong><code>val</code></strong>, <strong><code>test</code></strong>, <strong><code>user_count</code></strong>, <strong><code>item_count</code></strong>, <strong><code>sample_size</code></strong>, <strong><code>seed</code></strong>, <strong><code>flag</code></strong>, <strong><code>save_folder</code></strong>) :: <a href="/recohut/transforms.sampling.html#AbstractNegativeSampler"><code>AbstractNegativeSampler</code></a></p>
</blockquote>

</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="PopularNegativeSampler" class="doc_header"><code>class</code> <code>PopularNegativeSampler</code><a href="https://github.com/RecoHut-Projects/recohut/tree/master/recohut/transforms/sampling.py#L123" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>PopularNegativeSampler</code>(<strong><code>train</code></strong>, <strong><code>val</code></strong>, <strong><code>test</code></strong>, <strong><code>user_count</code></strong>, <strong><code>item_count</code></strong>, <strong><code>sample_size</code></strong>, <strong><code>seed</code></strong>, <strong><code>flag</code></strong>, <strong><code>save_folder</code></strong>) :: <a href="/recohut/transforms.sampling.html#AbstractNegativeSampler"><code>AbstractNegativeSampler</code></a></p>
</blockquote>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

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

</div>
    {% endraw %}

</div>
 

