---

title: Music30 dataset


keywords: fastai
sidebar: home_sidebar

summary: "Music30 dataset."
description: "Music30 dataset."
nb_path: "nbs/datasets/music30.ipynb"
---
<!--

#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: nbs/datasets/music30.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="Music30Dataset" class="doc_header"><code>class</code> <code>Music30Dataset</code><a href="https://github.com/RecoHut-Projects/recohut/tree/master/recohut/datasets/music30.py#L22" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>Music30Dataset</code>(<strong><code>root</code></strong>, <strong><code>process_method</code></strong>, <strong><code>min_session_length</code></strong>=<em><code>2</code></em>, <strong><code>min_item_support</code></strong>=<em><code>2</code></em>, <strong><code>num_slices</code></strong>=<em><code>5</code></em>, <strong><code>days_offset</code></strong>=<em><code>0</code></em>, <strong><code>days_shift</code></strong>=<em><code>95</code></em>, <strong><code>days_train</code></strong>=<em><code>90</code></em>, <strong><code>days_test</code></strong>=<em><code>5</code></em>) :: <a href="/recohut/base.html#SessionDataset"><code>SessionDataset</code></a></p>
</blockquote>
<p>Session data base class.</p>
<p>Args:
    min_session_length (int): Minimum number of items for a session to be valid
    min_item_support (int): Minimum number of interactions for an item to be valid
    eval_sec (int): these many seconds from the end will be taken as validation data</p>
<p>References:</p>

<pre><code>1. https://github.com/Ethan-Yys/GRU4REC-pytorch-master/blob/master/preprocessing.py</code></pre>

</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="input">

<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">musicdata</span> <span class="o">=</span> <span class="n">Music30Dataset</span><span class="p">(</span><span class="n">root</span><span class="o">=</span><span class="s1">&#39;/content/music30&#39;</span><span class="p">,</span> <span class="n">process_method</span><span class="o">=</span><span class="s1">&#39;last&#39;</span><span class="p">)</span>
</pre></div>

    </div>
</div>
</div>

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

<div class="output_area">

<div class="output_subarea output_stream output_stderr output_text">
<pre>Downloading https://github.com/RecoHut-Datasets/30music/raw/v1/30music.zip
Extracting /content/music30/raw/30music.zip
Processing...
</pre>
</div>
</div>

<div class="output_area">

<div class="output_subarea output_stream output_stdout output_text">
<pre>Loaded data set
	Events: 3707857
	Sessions: 200000
	Items: 1203432
	Span: 2014-01-20 / 2015-01-20


Filtered data set
	Events: 2953382
	Sessions: 190216
	Items: 452855
	Span: 2014-01-20 / 2015-01-20


Full train set
	Events: 2892862
	Sessions: 186627
	Items: 450895
Test set
	Events: 54606
	Sessions: 3468
	Items: 35100
Train set
	Events: 2847481
	Sessions: 183674
	Items: 449290
Validation set
	Events: 41785
	Sessions: 2852
	Items: 29293
</pre>
</div>
</div>

<div class="output_area">

<div class="output_subarea output_stream output_stderr output_text">
<pre>Done!
</pre>
</div>
</div>

</div>
</div>

</div>
    {% endraw %}

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

<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">musicdata</span> <span class="o">=</span> <span class="n">Music30Dataset</span><span class="p">(</span><span class="n">root</span><span class="o">=</span><span class="s1">&#39;/content/music30&#39;</span><span class="p">,</span> <span class="n">process_method</span><span class="o">=</span><span class="s1">&#39;last&#39;</span><span class="p">)</span>
</pre></div>

    </div>
</div>
</div>

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

<div class="output_area">

<div class="output_subarea output_stream output_stderr output_text">
<pre>Processing...
</pre>
</div>
</div>

<div class="output_area">

<div class="output_subarea output_stream output_stdout output_text">
<pre>Loaded data set
	Events: 3707857
	Sessions: 200000
	Items: 1203432
	Span: 2014-01-20 / 2015-01-20


Filtered data set
	Events: 2149666
	Sessions: 165766
	Items: 139016
	Span: 2014-01-20 / 2015-01-20


Full train set
	Events: 2105847
	Sessions: 162634
	Items: 138861
Test set
	Events: 41871
	Sessions: 3091
	Items: 23508
Train set
	Events: 2073194
	Sessions: 160047
	Items: 138755
Validation set
	Events: 31937
	Sessions: 2564
	Items: 20210
</pre>
</div>
</div>

<div class="output_area">

<div class="output_subarea output_stream output_stderr output_text">
<pre>Done!
</pre>
</div>
</div>

</div>
</div>

</div>
    {% endraw %}

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

<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="o">!</span>tree --du -h -C /content/music30
</pre></div>

    </div>
</div>
</div>

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

<div class="output_area">

<div class="output_subarea output_stream output_stdout output_text">
<pre><span class="ansi-blue-intense-fg ansi-bold">/content/music30</span>
├── [157M]  <span class="ansi-blue-intense-fg ansi-bold">processed</span>
│   ├── [1.6M]  events_test.txt
│   ├── [ 78M]  events_train_full.txt
│   ├── [ 77M]  events_train_tr.txt
│   └── [1.2M]  events_train_valid.txt
└── [137M]  <span class="ansi-blue-intense-fg ansi-bold">raw</span>
    └── [137M]  30music-200ks.csv

 295M used in 2 directories, 5 files
</pre>
</div>
</div>

</div>
</div>

</div>
    {% endraw %}

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

<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="o">!</span>rm /content/music30/processed/*
<span class="n">musicdata</span> <span class="o">=</span> <span class="n">Music30Dataset</span><span class="p">(</span><span class="n">root</span><span class="o">=</span><span class="s1">&#39;/content/music30&#39;</span><span class="p">,</span> <span class="n">process_method</span><span class="o">=</span><span class="s1">&#39;days_test&#39;</span><span class="p">)</span>
</pre></div>

    </div>
</div>
</div>

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

<div class="output_area">

<div class="output_subarea output_stream output_stderr output_text">
<pre>Processing...
</pre>
</div>
</div>

<div class="output_area">

<div class="output_subarea output_stream output_stdout output_text">
<pre>Loaded data set
	Events: 3707857
	Sessions: 200000
	Items: 1203432
	Span: 2014-01-20 / 2015-01-20


Filtered data set
	Events: 2149666
	Sessions: 165766
	Items: 139016
	Span: 2014-01-20 / 2015-01-20


Full train set
	Events: 2073194
	Sessions: 160047
	Items: 138755
Test set
	Events: 73532
	Sessions: 5652
	Items: 36423
</pre>
</div>
</div>

<div class="output_area">

<div class="output_subarea output_stream output_stderr output_text">
<pre>Done!
</pre>
</div>
</div>

</div>
</div>

</div>
    {% endraw %}

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

<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="o">!</span>tree --du -h -C /content/music30
</pre></div>

    </div>
</div>
</div>

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

<div class="output_area">

<div class="output_subarea output_stream output_stdout output_text">
<pre><span class="ansi-blue-intense-fg ansi-bold">/content/music30</span>
├── [ 79M]  <span class="ansi-blue-intense-fg ansi-bold">processed</span>
│   ├── [2.7M]  events_test.txt
│   └── [ 77M]  events_train_full.txt
└── [137M]  <span class="ansi-blue-intense-fg ansi-bold">raw</span>
    └── [137M]  30music-200ks.csv

 217M used in 2 directories, 3 files
</pre>
</div>
</div>

</div>
</div>

</div>
    {% endraw %}

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

<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="o">!</span>rm /content/music30/processed/*
<span class="n">musicdata</span> <span class="o">=</span> <span class="n">Music30Dataset</span><span class="p">(</span><span class="n">root</span><span class="o">=</span><span class="s1">&#39;/content/music30&#39;</span><span class="p">,</span> <span class="n">process_method</span><span class="o">=</span><span class="s1">&#39;slice&#39;</span><span class="p">)</span>
</pre></div>

    </div>
</div>
</div>

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

<div class="output_area">

<div class="output_subarea output_stream output_stderr output_text">
<pre>Processing...
</pre>
</div>
</div>

<div class="output_area">

<div class="output_subarea output_stream output_stdout output_text">
<pre>Loaded data set
	Events: 3707857
	Sessions: 200000
	Items: 1203432
	Span: 2014-01-20 / 2015-01-20


Filtered data set
	Events: 2149666
	Sessions: 165766
	Items: 139016
	Span: 2014-01-20 / 2015-01-20


</pre>
</div>
</div>

<div class="output_area">

<div class="output_subarea output_stream output_stderr output_text">
<pre>Done!
</pre>
</div>
</div>

</div>
</div>

</div>
    {% endraw %}

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

<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="o">!</span>tree --du -h -C /content/music30
</pre></div>

    </div>
</div>
</div>

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

<div class="output_area">

<div class="output_subarea output_stream output_stdout output_text">
<pre><span class="ansi-blue-intense-fg ansi-bold">/content/music30</span>
├── [4.0K]  <span class="ansi-blue-intense-fg ansi-bold">processed</span>
└── [137M]  <span class="ansi-blue-intense-fg ansi-bold">raw</span>
    └── [137M]  30music-200ks.csv

 137M used in 2 directories, 1 file
</pre>
</div>
</div>

</div>
</div>

</div>
    {% endraw %}

</div>
 

