--- title: NowPlaying dataset keywords: fastai sidebar: home_sidebar summary: "NowPlaying dataset." description: "NowPlaying dataset." nb_path: "nbs/datasets/datasets.nowplaying.ipynb" ---
{% raw %}
{% endraw %} {% raw %}
{% endraw %} {% raw %}

## `class` `NowPlayingDataset`[source]

> `NowPlayingDataset`(`root`, `process_method`, `min_session_length`=`2`, `min_item_support`=`2`, `num_slices`=`5`, `days_offset`=`0`, `days_shift`=`95`, `days_train`=`90`, `days_test`=`5`) :: `SessionDataset`

Session data base class.

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

References:

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

{% endraw %} {% raw %}
{% endraw %} {% raw %}

    !rm -r /content/nowplaying/processed/*
    npdata = NowPlayingDataset(root='/content/nowplaying', process_method='last')

    Downloading https://github.com/RecoHut-Datasets/nowplaying/raw/v2/nowplaying.zip
    Extracting /content/nowplaying/raw/nowplaying.zip
    Processing...

    Loaded data set
    	Events: 1587776
    	Sessions: 156958
    	Items: 258322
    	Span: 2014-01-03 / 2015-06-22

    Filtered data set
    	Events: 1471664
    	Sessions: 153383
    	Items: 145045
    	Span: 2014-01-03 / 2015-06-22

    Full train set
    	Events: 1469377
    	Sessions: 153168
    	Items: 145037
    Test set
    	Events: 2262
    	Sessions: 215
    	Items: 1841
    Train set
    	Events: 1466700
    	Sessions: 152892
    	Items: 145019
    Validation set
    	Events: 2634
    	Sessions: 276
    	Items: 2238

    Done!

{% endraw %} {% raw %}

    !tree --du -h -C /content/nowplaying

    /content/nowplaying
    ├── [ 96M]  processed
    │   ├── [ 76K]  events_test.txt
    │   ├── [ 48M]  events_train_full.txt
    │   ├── [ 48M]  events_train_tr.txt
    │   └── [ 89K]  events_train_valid.txt
    └── [ 54M]  raw
        └── [ 54M]  nowplaying.csv

     150M used in 2 directories, 5 files

{% endraw %} {% raw %}

    !rm -r /content/nowplaying/processed/*
    npdata = NowPlayingDataset(root='/content/nowplaying', process_method='days_test')

    Processing...

    Loaded data set
    	Events: 1587776
    	Sessions: 156958
    	Items: 258322
    	Span: 2014-01-03 / 2015-06-22

    Filtered data set
    	Events: 1471664
    	Sessions: 153383
    	Items: 145045
    	Span: 2014-01-03 / 2015-06-22

    Full train set
    	Events: 1459201
    	Sessions: 152086
    	Items: 144863
    Test set
    	Events: 11993
    	Sessions: 1286
    	Items: 8449

    Done!

{% endraw %} {% raw %}

    !tree --du -h -C /content/nowplaying

    /content/nowplaying
    ├── [ 48M]  processed
    │   ├── [406K]  events_test.txt
    │   └── [ 48M]  events_train_full.txt
    └── [ 54M]  raw
        └── [ 54M]  nowplaying.csv

     102M used in 2 directories, 3 files

{% endraw %} {% raw %}

    !rm -r /content/nowplaying/processed/*
    npdata = NowPlayingDataset(root='/content/nowplaying', process_method='slice')

    Processing...

    Loaded data set
    	Events: 1587776
    	Sessions: 156958
    	Items: 258322
    	Span: 2014-01-03 / 2015-06-22

    Filtered data set
    	Events: 1471664
    	Sessions: 153383
    	Items: 145045
    	Span: 2014-01-03 / 2015-06-22

    Full data set 0
    	Events: 1471664
    	Sessions: 153383
    	Items: 145045
    	Span: 2014-01-03T00:56:05+00:00 / 2015-06-22T01:09:22+00:00
    Slice data set 0
    	Events: 181916
    	Sessions: 19510
    	Items: 57310
    	Span: 2014-01-03 / 2014-04-03 / 2014-04-08
    Train set 0
    	Events: 162294
    	Sessions: 17418
    	Items: 53350
    	Span: 2014-01-03 / 2014-04-03
    Test set 0
    	Events: 14641
    	Sessions: 1930
    	Items: 8273
    	Span: 2014-04-03 / 2014-04-08

    Full data set 1
    	Events: 1471664
    	Sessions: 153383
    	Items: 145045
    	Span: 2014-01-03T00:56:05+00:00 / 2015-06-22T01:09:22+00:00
    Slice data set 1
    	Events: 306065
    	Sessions: 33152
    	Items: 76007
    	Span: 2014-04-08 / 2014-07-07 / 2014-07-12
    Train set 1
    	Events: 289659
    	Sessions: 31264
    	Items: 73786
    	Span: 2014-04-08 / 2014-07-07
    Test set 1
    	Events: 13730
    	Sessions: 1812
    	Items: 8835
    	Span: 2014-07-07 / 2014-07-12

    Full data set 2
    	Events: 1471664
    	Sessions: 153383
    	Items: 145045
    	Span: 2014-01-03T00:56:05+00:00 / 2015-06-22T01:09:22+00:00
    Slice data set 2
    	Events: 313537
    	Sessions: 31904
    	Items: 75732
    	Span: 2014-07-12 / 2014-10-10 / 2014-10-15
    Train set 2
    	Events: 297065
    	Sessions: 30308
    	Items: 73746
    	Span: 2014-07-12 / 2014-10-10
    Test set 2
    	Events: 14148
    	Sessions: 1535
    	Items: 7955
    	Span: 2014-10-10 / 2014-10-15

    Full data set 3
    	Events: 1471664
    	Sessions: 153383
    	Items: 145045
    	Span: 2014-01-03T00:56:05+00:00 / 2015-06-22T01:09:22+00:00
    Slice data set 3
    	Events: 217179
    	Sessions: 22175
    	Items: 64982
    	Span: 2014-10-15 / 2015-01-13 / 2015-01-18
    Train set 3
    	Events: 217179
    	Sessions: 22175
    	Items: 64982
    	Span: 2014-10-15 / 2015-01-13
    Test set 3
    	Events: 0
    	Sessions: 0
    	Items: 0
    	Span: 2015-01-13 / 2015-01-18

    Full data set 4
    	Events: 1471664
    	Sessions: 153383
    	Items: 145045
    	Span: 2014-01-03T00:56:05+00:00 / 2015-06-22T01:09:22+00:00
    Slice data set 4
    	Events: 293509
    	Sessions: 30423
    	Items: 80761
    	Span: 2015-01-18 / 2015-04-18 / 2015-04-23
    Train set 4
    	Events: 278156
    	Sessions: 29059
    	Items: 78269
    	Span: 2015-01-18 / 2015-04-18
    Test set 4
    	Events: 12287
    	Sessions: 1276
    	Items: 8609
    	Span: 2015-04-18 / 2015-04-23

    Done!

{% endraw %} {% raw %}

    !tree --du -h -C /content/nowplaying

    /content/nowplaying
    ├── [ 43M]  processed
    │   ├── [486K]  events_test.0.txt
    │   ├── [458K]  events_test.1.txt
    │   ├── [474K]  events_test.2.txt
    │   ├── [  36]  events_test.3.txt
    │   ├── [415K]  events_test.4.txt
    │   ├── [5.3M]  events_train_full.0.txt
    │   ├── [9.5M]  events_train_full.1.txt
    │   ├── [9.7M]  events_train_full.2.txt
    │   ├── [7.1M]  events_train_full.3.txt
    │   └── [9.2M]  events_train_full.4.txt
    └── [ 54M]  raw
        └── [ 54M]  nowplaying.csv

      96M used in 2 directories, 11 files

{% endraw %}