History of kuairec
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/kuairec/__init__.py b/entries/kuairec/__init__.py
index a33a1ba..9a2f2a3 100644
--- a/entries/kuairec/__init__.py
+++ b/entries/kuairec/__init__.py
@@ -69,7 +69,7 @@ tags = ['Social', 'Online', 'Preferences', 'Bipartite', 'Multigraph', 'Timestamp
url = ['https://kuairec.com/', 'https://doi.org/10.5281/zenodo.18164998']
citation = [('C. Gao, S. Li, W. Lei, J. Chen, B. Li, P. Jiang, X. He, J. Mao, T.-S. Chua, "KuaiRec: A Fully-Observed Dataset and Insights for Evaluating Recommender Systems." Proceedings of the 31st ACM International Conference on Information and Knowledge Management (CIKM), 540-550 (2022)',
'https://doi.org/10.1145/3511808.3557220')]
-icon_hash = None
+date_added = '2026-10-28'
upstream_license = ('CC BY-SA 4.0', 'https://github.com/chongminggao/KuaiRec/blob/a22f13b07d8b9d6b15e0cec2e97393f2bb0c40b3/LICENSE')
upstream_prefix = 'https://zenodo.org/records/18164998/files'
[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/kuairec/__init__.py b/entries/kuairec/__init__.py
index 1ddbd5f..a33a1ba 100644
--- a/entries/kuairec/__init__.py
+++ b/entries/kuairec/__init__.py
@@ -36,13 +36,35 @@ The node properties of the users come from the user features of the source (incl
The networks have the following properties:
-- `is_user` (`big`, `small`): whether the node is a user (otherwise it is a video).
-- `id`: the identifier of the user or video in the dataset.
-- User properties (empty, or -1, for videos): `user_active_degree` (the activity level, e.g. `full_active`, `high_active`), `is_lowactive_period`, `is_live_author`, `is_photo_author`, `follow_user_num`, `fans_user_num`, `friend_user_num`, `register_days` (days since registration), `gender`, `age_range`, `phone_brand`, `phone_model`, `mod_price` (the price of the phone model), `fre_country`, `fre_country_region`, `fre_province`, `fre_city`, `fre_city_level`, `fre_community_type` (the most frequent location of the user), `is_install_douyin`, `is_install_huoshan`, `is_install_xigua`, `is_install_douyu`, `is_install_huya`, `is_install_yy` (whether other video apps are installed), `platform`, `os_version`, `app_download_channel`, `app_version`, `isp` (the internet service provider), as given by the source (`UNKNOWN`, or -1 for the counts and flags, if unknown), and `onehot_features` (the 18 anonymized categorical features `onehot_feat0` to `onehot_feat17`).
-- Video properties (`big`, `small`; empty, -1 or NaN for users): `author_id`, `video_type` (`NORMAL` or `AD`), `upload_time` (the upload date, as Unix time), `upload_type` (e.g. `ShortImport`), `visible_status` (`public`, `private` or `only friends`), `duration` (in milliseconds), `width`, `height` (in pixels), `music_id`, `video_tag_id`, `video_tag_name` (the tag of the video, in Chinese), `tags` (the ids of the categories of the video, comma-separated), `caption`, `manual_cover_text` (the text on the cover of the video), `topic_tag` (the topic hashtags, as a list), `first_level_category`, `second_level_category`, `third_level_category` (the names of the categories of the video at three levels, in Chinese, `UNKNOWN` if none).
-- Edge `time` (`big`, `small`): the time of the view, as Unix time (with milliseconds; NaN if missing).
-- Edge `play_duration` (`big`, `small`): how long the user watched the video, in milliseconds.
-- Edge `watch_ratio` (`big`, `small`): the ratio of the time watched to the duration of the video (it can exceed 1, if the video was replayed)."""
+- (Node) `is_user` (`big`, `small`): whether the node is a user (otherwise it is a video).
+- (Node) `id`: the identifier of the user or video in the dataset.
+- (Node) The user properties below are as given by the source (`UNKNOWN`, or -1 for the counts and flags, if unknown), and empty, or -1, for videos.
+- (Node) `user_active_degree` (users): the activity level, e.g. `full_active`, `high_active`.
+- (Node) `is_lowactive_period`, `is_live_author`, `is_photo_author`, `follow_user_num`, `fans_user_num`, `friend_user_num`, `gender`, `age_range`, `phone_brand`, `phone_model`, `platform`, `os_version`, `app_download_channel`, `app_version` (users): the corresponding attributes of the user.
+- (Node) `register_days` (users): days since registration.
+- (Node) `mod_price` (users): the price of the phone model.
+- (Node) `fre_country`, `fre_country_region`, `fre_province`, `fre_city`, `fre_city_level`, `fre_community_type` (users): the most frequent location of the user.
+- (Node) `is_install_douyin`, `is_install_huoshan`, `is_install_xigua`, `is_install_douyu`, `is_install_huya`, `is_install_yy` (users): whether other video apps are installed.
+- (Node) `isp` (users): the internet service provider.
+- (Node) `onehot_features` (users): the 18 anonymized categorical features `onehot_feat0` to `onehot_feat17`.
+- (Node) The video properties below (in `big` and `small`) are empty, -1 or NaN for users.
+- (Node) `author_id` (videos): the id of the author of the video.
+- (Node) `video_type` (videos): `NORMAL` or `AD`.
+- (Node) `upload_time` (videos): the upload date, as Unix time.
+- (Node) `upload_type` (videos): e.g. `ShortImport`.
+- (Node) `visible_status` (videos): `public`, `private` or `only friends`.
+- (Node) `duration` (videos): in milliseconds.
+- (Node) `width`, `height` (videos): in pixels.
+- (Node) `music_id`, `video_tag_id` (videos): the ids of the music and of the tag of the video.
+- (Node) `video_tag_name` (videos): the tag of the video, in Chinese.
+- (Node) `tags` (videos): the ids of the categories of the video, comma-separated.
+- (Node) `caption` (videos): the caption of the video.
+- (Node) `manual_cover_text` (videos): the text on the cover of the video.
+- (Node) `topic_tag` (videos): the topic hashtags, as a list.
+- (Node) `first_level_category`, `second_level_category`, `third_level_category` (videos): the names of the categories of the video at three levels, in Chinese, `UNKNOWN` if none.
+- (Edge) `time` (`big`, `small`): the time of the view, as Unix time (with milliseconds; NaN if missing).
+- (Edge) `play_duration` (`big`, `small`): how long the user watched the video, in milliseconds.
+- (Edge) `watch_ratio` (`big`, `small`): the ratio of the time watched to the duration of the video (it can exceed 1, if the video was replayed)."""
tags = ['Social', 'Online', 'Preferences', 'Bipartite', 'Multigraph', 'Timestamps', 'Metadata']
url = ['https://kuairec.com/', 'https://doi.org/10.5281/zenodo.18164998']
citation = [('C. Gao, S. Li, W. Lei, J. Chen, B. Li, P. Jiang, X. He, J. Mao, T.-S. Chua, "KuaiRec: A Fully-Observed Dataset and Insights for Evaluating Recommender Systems." Proceedings of the 31st ACM International Conference on Information and Knowledge Management (CIKM), 540-550 (2022)',
[entries] New entry: kuairec 6c0e792
diff --git a/entries/kuairec/__init__.py b/entries/kuairec/__init__.py
new file mode 100644
index 0000000..1ddbd5f
--- /dev/null
+++ b/entries/kuairec/__init__.py
@@ -0,0 +1,222 @@
+#! /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 ast
+import pyarrow
+import pyarrow.csv
+import pyarrow.compute as pc
+
+from .. import *
+
+title = "Kuaishou short video views, fully observed (KuaiRec, 2020)"
+description = r"""Networks of the users of the short video sharing app Kuaishou (快手), the videos they watched, and their friendships, from the KuaiRec dataset, collected by C. Gao and colleagues (University of Science and Technology of China, Kuaishou and the National University of Singapore) from the recommendation logs of the app between 22 June and 10 September 2020. Its distinguishing feature is a "fully observed" part: for a set of 1,411 users and 3,327 videos, the videos were shown to all the users, so that the users' reactions to almost all of the videos are known (99.6%; the missing ones are videos of authors that the users had blocked).
+
+There are three networks:
+
+- `big`: the views of 7,176 users and 10,728 videos (the "big matrix" of the source, 12.5 million views, of which 2.2 million repeat an earlier view of the same video by the same user). A directed edge from a user to a video is a view of the video by the user. The network is bipartite and a multigraph.
+- `small`: the views of the fully observed part (the "small matrix", 1,411 users and 3,327 videos, 4.7 million views), in the same form, with only these users and videos. Its views are not part of `big` (the two sets of views are disjoint, although the users and videos of `small` also appear in `big`). The time of 181,992 of these views is missing.
+- `social`: the friendships among the 7,176 users (an undirected edge between two users who are friends). Only 472 users have friends in the data.
+
+The node properties of the users come from the user features of the source (including the raw features released in January 2026: gender, age range, phone, location, installed apps, ...). Those of the videos come from the daily video features (the values of the last day, for the few that change over time: visibility, size and tag), and from the captions and categories released in June 2024. The daily statistics of the videos (counts of plays, likes, comments, ... per day), the binned versions of the counts of the users, and the multi-level category annotations with probabilities (`video_raw_categories_multi.csv`) are left out. The user and video identifiers are those of the source (re-indexed by it).
+
+The networks have the following properties:
+
+- `is_user` (`big`, `small`): whether the node is a user (otherwise it is a video).
+- `id`: the identifier of the user or video in the dataset.
+- User properties (empty, or -1, for videos): `user_active_degree` (the activity level, e.g. `full_active`, `high_active`), `is_lowactive_period`, `is_live_author`, `is_photo_author`, `follow_user_num`, `fans_user_num`, `friend_user_num`, `register_days` (days since registration), `gender`, `age_range`, `phone_brand`, `phone_model`, `mod_price` (the price of the phone model), `fre_country`, `fre_country_region`, `fre_province`, `fre_city`, `fre_city_level`, `fre_community_type` (the most frequent location of the user), `is_install_douyin`, `is_install_huoshan`, `is_install_xigua`, `is_install_douyu`, `is_install_huya`, `is_install_yy` (whether other video apps are installed), `platform`, `os_version`, `app_download_channel`, `app_version`, `isp` (the internet service provider), as given by the source (`UNKNOWN`, or -1 for the counts and flags, if unknown), and `onehot_features` (the 18 anonymized categorical features `onehot_feat0` to `onehot_feat17`).
+- Video properties (`big`, `small`; empty, -1 or NaN for users): `author_id`, `video_type` (`NORMAL` or `AD`), `upload_time` (the upload date, as Unix time), `upload_type` (e.g. `ShortImport`), `visible_status` (`public`, `private` or `only friends`), `duration` (in milliseconds), `width`, `height` (in pixels), `music_id`, `video_tag_id`, `video_tag_name` (the tag of the video, in Chinese), `tags` (the ids of the categories of the video, comma-separated), `caption`, `manual_cover_text` (the text on the cover of the video), `topic_tag` (the topic hashtags, as a list), `first_level_category`, `second_level_category`, `third_level_category` (the names of the categories of the video at three levels, in Chinese, `UNKNOWN` if none).
+- Edge `time` (`big`, `small`): the time of the view, as Unix time (with milliseconds; NaN if missing).
+- Edge `play_duration` (`big`, `small`): how long the user watched the video, in milliseconds.
+- Edge `watch_ratio` (`big`, `small`): the ratio of the time watched to the duration of the video (it can exceed 1, if the video was replayed)."""
+tags = ['Social', 'Online', 'Preferences', 'Bipartite', 'Multigraph', 'Timestamps', 'Metadata']
+url = ['https://kuairec.com/', 'https://doi.org/10.5281/zenodo.18164998']
+citation = [('C. Gao, S. Li, W. Lei, J. Chen, B. Li, P. Jiang, X. He, J. Mao, T.-S. Chua, "KuaiRec: A Fully-Observed Dataset and Insights for Evaluating Recommender Systems." Proceedings of the 31st ACM International Conference on Information and Knowledge Management (CIKM), 540-550 (2022)',
+ 'https://doi.org/10.1145/3511808.3557220')]
+icon_hash = None
+upstream_license = ('CC BY-SA 4.0', 'https://github.com/chongminggao/KuaiRec/blob/a22f13b07d8b9d6b15e0cec2e97393f2bb0c40b3/LICENSE')
+upstream_prefix = 'https://zenodo.org/records/18164998/files'
+
+DATA = "KuaiRec.zip:KuaiRec 2.0/data"
+COMMON = (f"{DATA}/user_features.csv", "user_features_raw.csv",
+ f"{DATA}/item_daily_features.csv", f"{DATA}/item_categories.csv",
+ "kuairec_caption_category.csv")
+files = [(COMMON + (f"{DATA}/big_matrix.csv",), "big", None),
+ (COMMON + (f"{DATA}/small_matrix.csv",), "small", None),
+ ((f"{DATA}/user_features.csv", "user_features_raw.csv",
+ f"{DATA}/social_network.csv"), "social", None)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force, check=False)
+
+def read_table(name, fname, types=None):
+ with open_upstream_file(name, fname, "rb") as f:
+ # (the captions contain unquoted carriage returns, replaced by
+ # spaces)
+ data = f.read().replace(b"\r", b" ")
+ return pyarrow.csv.read_csv(
+ io.BytesIO(data), parse_options=pyarrow.csv.ParseOptions(newlines_in_values=True),
+ convert_options=pyarrow.csv.ConvertOptions(
+ column_types=types or {}, strings_can_be_null=False))
+
+def fill(a, default):
+ "The array `a` as numpy, with nulls replaced by `default`."
+ return pc.fill_null(a, default).to_numpy(zero_copy_only=False)
+
+USER_INT = ["is_lowactive_period", "is_live_author", "is_photo_author",
+ "follow_user_num", "fans_user_num", "friend_user_num",
+ "register_days", "is_install_douyin",
+ "is_install_huoshan", "is_install_xigua", "is_install_douyu",
+ "is_install_huya", "is_install_yy"]
+USER_STR = ["user_active_degree", "gender", "age_range", "phone_brand",
+ "phone_model", "mod_price", "fre_country", "fre_country_region", "fre_province",
+ "fre_city", "fre_city_level", "fre_community_type", "platform",
+ "os_version", "app_download_channel", "app_version", "isp"]
+
+def set_props(g, idx, table, cols, t, default, rename={}):
+ """Set the vertex properties of type `t` from the columns `cols` of
+ `table`, for the vertices `idx` (the others get `default`)."""
+ N = g.num_vertices()
+ for c in cols:
+ if t == "string":
+ vals = [default] * N
+ for i, x in zip(idx, table[c].to_pylist()):
+ vals[i] = "" if x is None else str(x)
+ p = g.new_vp("string", vals=vals)
+ else:
+ p = g.new_vp(t)
+ p.a[:] = default
+ p.a[idx] = fill(table[c].cast(pyarrow.float64() if t == "double"
+ else pyarrow.int64()), default)
+ g.vp[rename.get(c, c)] = p
+
+def only(table, col, ids):
+ "The rows of `table` whose column `col` is in the sorted array `ids`."
+ return table.filter(pyarrow.array(numpy.isin(table[col].to_numpy(), ids)))
+
+def set_user_props(g, name, fnames, uids):
+ users = only(read_table(name, fnames[0]), "user_id", uids)
+ raw = only(read_table(name, fnames[1], {c: pyarrow.string() for c in USER_STR}),
+ "user_id", uids)
+ assert raw["user_id"].to_pylist() == users["user_id"].to_pylist()
+ idx = numpy.searchsorted(uids, users["user_id"].to_numpy())
+ set_props(g, idx, raw, USER_STR, "string", "")
+ set_props(g, idx, raw, USER_INT, "int64_t", -1)
+ oh = numpy.column_stack([fill(users[f"onehot_feat{i}"].cast(pyarrow.float64()),
+ numpy.nan) for i in range(18)])
+ p = g.new_vp("vector<double>")
+ for i, row in zip(idx, oh):
+ p[i] = row
+ g.vp.onehot_features = p
+
+@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
+ if alt == "social":
+ users = read_table(name, fnames[0])
+ uids = numpy.sort(users["user_id"].to_numpy())
+ g = Graph(directed=False)
+ g.add_vertex(len(uids))
+ g.vp.id = g.new_vp("int64_t", vals=uids)
+ set_user_props(g, name, fnames, uids)
+ # "user_id,friend_list", e.g. 24,[2665]; the lists are symmetric
+ soc = read_table(name, fnames[2])
+ pairs = set()
+ for u, fl in zip(soc["user_id"].to_pylist(),
+ soc["friend_list"].to_pylist()):
+ for v in ast.literal_eval(fl):
+ pairs.add((min(u, v), max(u, v)))
+ pairs = numpy.array(sorted(pairs), dtype="int64")
+ g.add_edge_list(numpy.searchsorted(uids, pairs))
+ yield alt, g
+ continue
+
+ views = read_table(name, fnames[5])
+ # `big`: all the users and videos; `small`: those with views
+ uids = numpy.unique(views["user_id"].to_numpy())
+ if alt == "big":
+ users = read_table(name, fnames[0])
+ uids = numpy.union1d(users["user_id"].to_numpy(), uids)
+ daily = read_table(name, fnames[2], {"upload_dt": pyarrow.string(),
+ "video_tag_name": pyarrow.string()})
+ # the features of the last day of each video
+ daily = daily.sort_by([("video_id", "ascending"), ("date", "ascending")])
+ vid = daily["video_id"].to_numpy()
+ last = numpy.r_[vid[1:] != vid[:-1], True]
+ daily = daily.filter(pyarrow.array(last))
+ cats = read_table(name, fnames[3])
+ caps = read_table(name, fnames[4])
+ vids = numpy.unique(views["video_id"].to_numpy())
+ if alt == "big":
+ vids = numpy.unique(numpy.concatenate([vids,
+ daily["video_id"].to_numpy(),
+ cats["video_id"].to_numpy(),
+ caps["video_id"].to_numpy()]))
+ daily = only(daily, "video_id", vids)
+ cats = only(cats, "video_id", vids)
+ caps = only(caps, "video_id", vids)
+ U = len(uids)
+ g = Graph(directed=True)
+ g.add_vertex(U + len(vids))
+ uidx = lambda x: numpy.searchsorted(uids, x)
+ vidx = lambda x: U + numpy.searchsorted(vids, x)
+ g.vp.is_user = g.new_vp("bool")
+ g.vp.is_user.a[:U] = 1
+ g.vp.id = g.new_vp("int64_t")
+ g.vp.id.a[:U] = uids
+ g.vp.id.a[U:] = vids
+ set_user_props(g, name, fnames, uids)
+
+ idx = vidx(daily["video_id"].to_numpy())
+ set_props(g, idx, daily, ["author_id", "music_id", "video_tag_id"],
+ "int64_t", -1)
+ set_props(g, idx, daily, ["video_duration", "video_width", "video_height"],
+ "double", numpy.nan,
+ {"video_duration": "duration", "video_width": "width",
+ "video_height": "height"})
+ set_props(g, idx, daily, ["video_type", "upload_type", "visible_status",
+ "video_tag_name"], "string", "")
+ up = pc.strptime(daily["upload_dt"], format="%Y-%m-%d", unit="s",
+ error_is_null=True)
+ g.vp.upload_time = g.new_vp("int64_t")
+ g.vp.upload_time.a[:] = -1
+ g.vp.upload_time.a[idx] = fill(up.cast(pyarrow.int64()), -1)
+ # "[27, 9]" -> "27,9"
+ vals = [""] * g.num_vertices()
+ for i, x in zip(vidx(cats["video_id"].to_numpy()), cats["feat"].to_pylist()):
+ vals[i] = ",".join(str(t) for t in ast.literal_eval(x))
+ g.vp.tags = g.new_vp("string", vals=vals)
+ set_props(g, vidx(caps["video_id"].to_numpy()), caps,
+ ["caption", "manual_cover_text", "topic_tag",
+ "first_level_category_name", "second_level_category_name",
+ "third_level_category_name"], "string", "",
+ {"first_level_category_name": "first_level_category",
+ "second_level_category_name": "second_level_category",
+ "third_level_category_name": "third_level_category"})
+
+ g.add_edge_list(numpy.column_stack((uidx(views["user_id"].to_numpy()),
+ vidx(views["video_id"].to_numpy()))))
+ g.ep.time = g.new_ep("double", vals=fill(views["timestamp"], numpy.nan))
+ g.ep.play_duration = g.new_ep("int", vals=views["play_duration"].to_numpy())
+ g.ep.watch_ratio = g.new_ep("double", vals=views["watch_ratio"].to_numpy())
+ yield alt, g