History of yoochoose
The changes to the source code of this entry in the repository, newest first, each with the differences it made to the entry's files. They are also listed on GitLab.
[entries] Add the date when each entry was added, and remove icon_hash beff7c9
The dates are those of the commits that first added the entries' files (2020-08-11 for the entries of the initial commit); renamed entries keep the date of their first name. Changed: none
diff --git a/entries/yoochoose/__init__.py b/entries/yoochoose/__init__.py
index 4b392ce..37fac72 100644
--- a/entries/yoochoose/__init__.py
+++ b/entries/yoochoose/__init__.py
@@ -43,7 +43,7 @@ url = ['https://recsys.acm.org/recsys15/challenge/',
'https://s3-eu-west-1.amazonaws.com/yc-rdata/yoochoose-data.7z']
citation = [('D. Ben-Shimon, A. Tsikinovsky, M. Friedmann, B. Shapira, L. Rokach, J. Hoerle, "RecSys Challenge 2015 and the YOOCHOOSE Dataset." Proceedings of the 9th ACM Conference on Recommender Systems, 357-358 (2015)',
'https://doi.org/10.1145/2792838.2798723')]
-icon_hash = None
+date_added = '2026-10-28'
upstream_license = ('CC BY-NC-ND 4.0', 'https://creativecommons.org/licenses/by-nc-nd/4.0/')
upstream_prefix = 'https://s3-eu-west-1.amazonaws.com/yc-rdata'
files = [(('yoochoose-data.7z:yoochoose-clicks.dat',
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) bc3dbbd
The lists of properties at the end of the descriptions marked edge properties with "Edge" but left node properties unmarked, or grouped them in "Nodes: `a`, ...; `b`, ..." items, so the kind of a property was often unclear. Every item now starts with (Node), (Edge) or (Graph), followed by the property names, a colon and the explanation, one item per property or group of properties; qualifications (kinds of nodes, networks) follow the names in parentheses. Properties that were only named got a short explanation, and a few items that named the wrong kind of property were corrected.
diff --git a/entries/yoochoose/__init__.py b/entries/yoochoose/__init__.py
index 4b7a6ac..4b392ce 100644
--- a/entries/yoochoose/__init__.py
+++ b/entries/yoochoose/__init__.py
@@ -29,15 +29,15 @@ A directed edge from a session to an item is a click on the item during the sess
The network has the following properties:
-- `is_session`: whether the node is a session (otherwise it is an item).
-- `id`: the identifier of the session or item.
-- Edge `time`: the time of the click or purchase, as Unix time (with milliseconds).
-- Edge `buy`: whether the edge is a purchase (otherwise it is a click).
-- Edge `test`: whether the session is one of the test sessions of the challenge.
-- Edge `category` (clicks): the context of the click: 0 if missing, 1 to 12 for one of the categories of the shop, or the 8-10 digit identifier of a brand (-1 for special offers, and for purchases).
-- Edge `special_offer` (clicks): whether the item was clicked in the context of a special offer or promotion.
-- Edge `price` (purchases): the price of the item (modified by the source; -1 for clicks; 0 for 610,030 of the 1,150,753 purchases, whose price and quantity are not given).
-- Edge `quantity` (purchases): the number of items bought (-1 for clicks; 0 where not given)."""
+- (Node) `is_session`: whether the node is a session (otherwise it is an item).
+- (Node) `id`: the identifier of the session or item.
+- (Edge) `time`: the time of the click or purchase, as Unix time (with milliseconds).
+- (Edge) `buy`: whether the edge is a purchase (otherwise it is a click).
+- (Edge) `test`: whether the session is one of the test sessions of the challenge.
+- (Edge) `category` (clicks): the context of the click: 0 if missing, 1 to 12 for one of the categories of the shop, or the 8-10 digit identifier of a brand (-1 for special offers, and for purchases).
+- (Edge) `special_offer` (clicks): whether the item was clicked in the context of a special offer or promotion.
+- (Edge) `price` (purchases): the price of the item (modified by the source; -1 for clicks; 0 for 610,030 of the 1,150,753 purchases, whose price and quantity are not given).
+- (Edge) `quantity` (purchases): the number of items bought (-1 for clicks; 0 where not given)."""
tags = ['Economic', 'Commerce', 'Bipartite', 'Multigraph', 'Timestamps', 'Metadata']
url = ['https://recsys.acm.org/recsys15/challenge/',
'https://s3-eu-west-1.amazonaws.com/yc-rdata/yoochoose-data.7z']
[entries] New entry: yoochoose d235db5
diff --git a/entries/yoochoose/__init__.py b/entries/yoochoose/__init__.py
new file mode 100644
index 0000000..4b7a6ac
--- /dev/null
+++ b/entries/yoochoose/__init__.py
@@ -0,0 +1,141 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2026 Tiago de Paula Peixoto <tiago@skewed.de>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import pyarrow
+import pyarrow.csv
+import pyarrow.compute as pc
+
+from .. import *
+
+title = "YooChoose e-commerce sessions (RecSys Challenge 2015)"
+description = r"""A bipartite network of the browsing sessions of the customers of a European online retailer and the items they clicked on and bought, released by YooChoose GmbH for the RecSys Challenge 2015 (whose task was to predict which sessions end with a purchase, and which items are bought). The data were collected during six months of 2014 (April to September) by tracking the website of the retailer, whose identity is not disclosed; all numbers (identifiers, prices) were modified by the source to protect the privacy of the users and the retailer.
+
+A directed edge from a session to an item is a click on the item during the session, or a purchase of it (edge property `buy`). The network is a multigraph, since items are often clicked several times in a session. Sessions are not linked to persistent users. It combines the three files of the challenge: the clicks of the training sessions (`yoochoose-clicks.dat`, 33.0 million clicks), the purchases of these sessions (`yoochoose-buys.dat`, 1.15 million purchases; most training sessions have none), and the clicks of the test sessions (`yoochoose-test.dat`, 8.3 million clicks, marked by the edge property `test`), whose purchases are not given.
+
+The network has the following properties:
+
+- `is_session`: whether the node is a session (otherwise it is an item).
+- `id`: the identifier of the session or item.
+- Edge `time`: the time of the click or purchase, as Unix time (with milliseconds).
+- Edge `buy`: whether the edge is a purchase (otherwise it is a click).
+- Edge `test`: whether the session is one of the test sessions of the challenge.
+- Edge `category` (clicks): the context of the click: 0 if missing, 1 to 12 for one of the categories of the shop, or the 8-10 digit identifier of a brand (-1 for special offers, and for purchases).
+- Edge `special_offer` (clicks): whether the item was clicked in the context of a special offer or promotion.
+- Edge `price` (purchases): the price of the item (modified by the source; -1 for clicks; 0 for 610,030 of the 1,150,753 purchases, whose price and quantity are not given).
+- Edge `quantity` (purchases): the number of items bought (-1 for clicks; 0 where not given)."""
+tags = ['Economic', 'Commerce', 'Bipartite', 'Multigraph', 'Timestamps', 'Metadata']
+url = ['https://recsys.acm.org/recsys15/challenge/',
+ 'https://s3-eu-west-1.amazonaws.com/yc-rdata/yoochoose-data.7z']
+citation = [('D. Ben-Shimon, A. Tsikinovsky, M. Friedmann, B. Shapira, L. Rokach, J. Hoerle, "RecSys Challenge 2015 and the YOOCHOOSE Dataset." Proceedings of the 9th ACM Conference on Recommender Systems, 357-358 (2015)',
+ 'https://doi.org/10.1145/2792838.2798723')]
+icon_hash = None
+upstream_license = ('CC BY-NC-ND 4.0', 'https://creativecommons.org/licenses/by-nc-nd/4.0/')
+upstream_prefix = 'https://s3-eu-west-1.amazonaws.com/yc-rdata'
+files = [(('yoochoose-data.7z:yoochoose-clicks.dat',
+ 'yoochoose-data.7z:yoochoose-buys.dat',
+ 'yoochoose-data.7z:yoochoose-test.dat'), None, None)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force, check=False)
+
+# For checks only: if set, only (about) this many records of each file are read
+_check_rows = None
+
+def read(name, fname, cols, types):
+ "The table of the CSV file `fname` (without header)."
+ batches = []
+ n = 0
+ with open_upstream_file(name, fname, "rb") as f:
+ reader = pyarrow.csv.open_csv(
+ f, read_options=pyarrow.csv.ReadOptions(column_names=cols,
+ block_size=1 << 26),
+ convert_options=pyarrow.csv.ConvertOptions(column_types=types))
+ for b in reader:
+ if _check_rows is not None and n >= _check_rows:
+ break
+ n += b.num_rows
+ batches.append(b)
+ return pyarrow.Table.from_batches(batches)
+
+def to_time(ts):
+ "Unix time (with milliseconds) of the timestamps 2014-04-07T10:51:09.277Z."
+ t = pc.strptime(pc.utf8_slice_codeunits(ts, 0, 19), format="%Y-%m-%dT%H:%M:%S",
+ unit="s").cast(pyarrow.int64()).to_numpy()
+ ms = pc.cast(pc.utf8_slice_codeunits(ts, 20, 23), pyarrow.int64()).to_numpy()
+ return t + ms / 1000
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ name = __name__.split(".")[-1]
+ for fnames, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ ctypes = {"session": pyarrow.int64(), "time": pyarrow.string(),
+ "item": pyarrow.int64(), "category": pyarrow.string()}
+ clicks = read(name, fnames[0], list(ctypes), ctypes)
+ test = read(name, fnames[2], list(ctypes), ctypes)
+ btypes = {"session": pyarrow.int64(), "time": pyarrow.string(),
+ "item": pyarrow.int64(), "price": pyarrow.int64(),
+ "quantity": pyarrow.int64()}
+ buys = read(name, fnames[1], list(btypes), btypes)
+
+ parts = [clicks, buys, test]
+ sess = numpy.unique(numpy.concatenate([p["session"].to_numpy() for p in parts]))
+ items = numpy.unique(numpy.concatenate([p["item"].to_numpy() for p in parts]))
+ S = len(sess)
+ g = Graph(directed=True)
+ g.add_vertex(S + len(items))
+ g.vp.is_session = g.new_vp("bool")
+ g.vp.is_session.a[:S] = 1
+ g.vp.id = g.new_vp("int64_t")
+ g.vp.id.a[:S] = sess
+ g.vp.id.a[S:] = items
+
+ time, buy, istest, cat, special, price, qty = [], [], [], [], [], [], []
+ for i, p in enumerate(parts):
+ n = len(p)
+ g.add_edge_list(numpy.column_stack(
+ (numpy.searchsorted(sess, p["session"].to_numpy()),
+ S + numpy.searchsorted(items, p["item"].to_numpy()))))
+ time.append(to_time(p["time"]))
+ buy.append(numpy.full(n, i == 1))
+ istest.append(numpy.full(n, i == 2))
+ if i == 1:
+ cat.append(numpy.full(n, -1, dtype="int64"))
+ special.append(numpy.zeros(n, dtype="bool"))
+ price.append(p["price"].to_numpy())
+ qty.append(p["quantity"].to_numpy())
+ else:
+ c = p["category"]
+ s = pc.equal(c, "S")
+ special.append(s.to_numpy(zero_copy_only=False))
+ cat.append(pc.cast(pc.if_else(s, "-1", c), pyarrow.int64()).to_numpy())
+ price.append(numpy.full(n, -1, dtype="int64"))
+ qty.append(numpy.full(n, -1, dtype="int64"))
+ del parts, clicks, buys, test
+ g.ep.time = g.new_ep("double", vals=numpy.concatenate(time))
+ g.ep.buy = g.new_ep("bool", vals=numpy.concatenate(buy))
+ g.ep.test = g.new_ep("bool", vals=numpy.concatenate(istest))
+ g.ep.category = g.new_ep("int64_t", vals=numpy.concatenate(cat))
+ g.ep.special_offer = g.new_ep("bool", vals=numpy.concatenate(special))
+ g.ep.price = g.new_ep("int64_t", vals=numpy.concatenate(price))
+ g.ep.quantity = g.new_ep("int64_t", vals=numpy.concatenate(qty))
+ yield alt, g