logo Netzschleuder network catalog, repository, and centrifuge

History of amazon_reviews

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 by Tiago de Paula Peixoto 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/amazon_reviews/__init__.py b/entries/amazon_reviews/__init__.py
index 549e2b5..605335b 100644
--- a/entries/amazon_reviews/__init__.py
+++ b/entries/amazon_reviews/__init__.py
@@ -36,7 +36,7 @@ url = ['https://www.cs.cornell.edu/~arb/data/amazon-reviews/',
 citation = [('J. Ni, J. Li, J. McAuley, "Justifying Recommendations using Distantly-Labeled Reviews and Fine-Grained Aspects." Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), 188-197 (2019)', 'https://doi.org/10.18653/v1/D19-1018'),
             ('N. Veldt, A. R. Benson, J. Kleinberg, "Minimizing Localized Ratio Cut Objectives in Hypergraphs." Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 1708-1718 (2020)', 'https://doi.org/10.1145/3394486.3403222'),
             ('I. Amburg, N. Veldt, A. R. Benson, "Diverse and Experienced Group Discovery via Hypergraph Clustering." Proceedings of the 2022 SIAM International Conference on Data Mining (SDM), 145-153 (2022)', 'https://doi.org/10.1137/1.9781611977172.17')]
-icon_hash = None
+date_added = '2026-10-25'
 upstream_license = None
 upstream_prefix = 'gdrive://'
 files = [(('1dOeke9Rdh0vySIrsSqIZbGXIggVFqZwP:zip:amazon-reviews/hyperedges-amazon-reviews.txt',
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) by Tiago de Paula Peixoto 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/amazon_reviews/__init__.py b/entries/amazon_reviews/__init__.py
index 2159ba8..549e2b5 100644
--- a/entries/amazon_reviews/__init__.py
+++ b/entries/amazon_reviews/__init__.py
@@ -26,8 +26,10 @@ description = """Bipartite networks of reviewers and products derived from the A
 
 The networks have the following properties:
 
-- `reviews`: `is_user`, whether the node is a user (otherwise a product); `category`, the product category (e.g. "Appliances", "Video_Games"; empty for users).
-- `music_blues`: `is_group`, whether the node is a group of users who reviewed products of a given sub-genre in a given month (otherwise a user); `genre`, the blues sub-genre of the group (empty for users)."""
+- (Node) `is_user` (`reviews`): whether the node is a user (otherwise a product).
+- (Node) `category` (`reviews`): the product category (e.g. "Appliances", "Video_Games"; empty for users).
+- (Node) `is_group` (`music_blues`): whether the node is a group of users who reviewed products of a given sub-genre in a given month (otherwise a user).
+- (Node) `genre` (`music_blues`): the blues sub-genre of the group (empty for users)."""
 tags = ['Economic', 'Commerce', 'Online', 'Preferences', 'Unweighted', 'Metadata']
 url = ['https://www.cs.cornell.edu/~arb/data/amazon-reviews/',
        'https://www.cs.cornell.edu/~arb/data/cat-edge-music-blues-reviews/']
[entries] Remove unneeded code from the entries by Tiago de Paula Peixoto 2c69f19
Unneeded "global files" statements, unused imports and variables,
f-strings without placeholders, duplicate keys in foodweb_little_rock
(keeping the order and the values used), and the second definition of
get_lines() in twitter_higgs. Nothing changes in the networks or
descriptions.

Changed: none
diff --git a/entries/amazon_reviews/__init__.py b/entries/amazon_reviews/__init__.py
index ea3e4a0..2159ba8 100644
--- a/entries/amazon_reviews/__init__.py
+++ b/entries/amazon_reviews/__init__.py
@@ -54,7 +54,6 @@ def fetch_upstream(force=False):
 @coerce_props()
 @annotate()
 def parse(alts=None):
-    global files
     name = __name__.split(".")[-1]
     for fnames, alt, fmt in files:
         if alts is not None and alt not in alts:
[entries] New entry: amazon_reviews by Tiago de Paula Peixoto b3cfc7a
diff --git a/entries/amazon_reviews/__init__.py b/entries/amazon_reviews/__init__.py
new file mode 100644
index 0000000..ea3e4a0
--- /dev/null
+++ b/entries/amazon_reviews/__init__.py
@@ -0,0 +1,91 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020-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/>.
+
+from .. import *
+
+title = "Amazon product reviews (1996-2018)"
+description = """Bipartite networks of reviewers and products derived from the Amazon review data collected by J. Ni, J. Li and J. McAuley ([source](https://nijianmo.github.io/amazon/index.html)), which contains product reviews (with ratings, text and product metadata) from the Amazon online store, spanning May 1996 to October 2018. The networks were assembled by A. R. Benson and collaborators. Reviewers and products are anonymized and given only as integer indices.
+
+- `reviews`: products and the users who reviewed them, built from the "5-core" subsets of the data, in which, for each of the 29 product categories, only the users and products with at least five reviews in that category were kept. Each user is connected to every product they reviewed. The 33 products listed in the source data without any reviewer were removed.
+- `music_blues`: reviewers of music products tagged "regional blues" (a subset of vinyl records), grouped by time and sub-genre. The reviews were split into calendar months, and for each month and each sub-genre (e.g. "Chicago Blues") there is a group node connected to all users who reviewed a product of that sub-genre during that month. The same sub-genre can therefore give rise to many groups, and identical sets of users can appear in several groups. The reviews span the years 1998 to 2018, but the month of each group is not given in the source data. Users who belong to no group were removed.
+
+The networks have the following properties:
+
+- `reviews`: `is_user`, whether the node is a user (otherwise a product); `category`, the product category (e.g. "Appliances", "Video_Games"; empty for users).
+- `music_blues`: `is_group`, whether the node is a group of users who reviewed products of a given sub-genre in a given month (otherwise a user); `genre`, the blues sub-genre of the group (empty for users)."""
+tags = ['Economic', 'Commerce', 'Online', 'Preferences', 'Unweighted', 'Metadata']
+url = ['https://www.cs.cornell.edu/~arb/data/amazon-reviews/',
+       'https://www.cs.cornell.edu/~arb/data/cat-edge-music-blues-reviews/']
+citation = [('J. Ni, J. Li, J. McAuley, "Justifying Recommendations using Distantly-Labeled Reviews and Fine-Grained Aspects." Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), 188-197 (2019)', 'https://doi.org/10.18653/v1/D19-1018'),
+            ('N. Veldt, A. R. Benson, J. Kleinberg, "Minimizing Localized Ratio Cut Objectives in Hypergraphs." Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 1708-1718 (2020)', 'https://doi.org/10.1145/3394486.3403222'),
+            ('I. Amburg, N. Veldt, A. R. Benson, "Diverse and Experienced Group Discovery via Hypergraph Clustering." Proceedings of the 2022 SIAM International Conference on Data Mining (SDM), 145-153 (2022)', 'https://doi.org/10.1137/1.9781611977172.17')]
+icon_hash = None
+upstream_license = None
+upstream_prefix = 'gdrive://'
+files = [(('1dOeke9Rdh0vySIrsSqIZbGXIggVFqZwP:zip:amazon-reviews/hyperedges-amazon-reviews.txt',
+           '1dOeke9Rdh0vySIrsSqIZbGXIggVFqZwP:zip:amazon-reviews/node-labels-amazon-reviews.txt',
+           '1dOeke9Rdh0vySIrsSqIZbGXIggVFqZwP:zip:amazon-reviews/label-names-amazon-reviews.txt'),
+          'reviews', None),
+         (('1psnDq6Zdf2P1n-2zofF5uafEamNsJIZk:zip:cat-edge-music-blues-reviews/hyperedges.txt',
+           '1psnDq6Zdf2P1n-2zofF5uafEamNsJIZk:zip:cat-edge-music-blues-reviews/hyperedge-labels.txt',
+           '1psnDq6Zdf2P1n-2zofF5uafEamNsJIZk:zip:cat-edge-music-blues-reviews/hyperedge-label-identities.txt'),
+          'music_blues', None)]
+
+def fetch_upstream(force=False):
+    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+                                force)
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+    global files
+    name = __name__.split(".")[-1]
+    for fnames, alt, fmt in files:
+        if alts is not None and alt not in alts:
+            continue
+        if isinstance(fnames, str):
+            fnames = [fnames]
+        with ExitStack() as stack:
+            fs = [stack.enter_context(open_upstream_file(name, fn, "r")) for fn in fnames]
+            if alt == "reviews":
+                # One line per user: the (1-based) products it reviewed
+                users, products, n_users = read_hyperedges(fs[0], sep=",")
+                # Line i: the (1-based) category of product i
+                cat = read_ints(fs[1])
+                cnames = [line.rstrip("\r\n") for line in fs[2]]
+                # Only the products that occur in some review
+                used, products = numpy.unique(products, return_inverse=True)
+                g = bipartite_graph(users, products, n_users, len(used),
+                                    "is_user")
+                del users, products
+                g.vp.category = g.new_vp("string")
+                for v, c in enumerate(cat[used]):
+                    g.vp.category[g.vertex(v)] = cnames[c - 1]
+            else:
+                # One line per group: its (1-based) users, space-separated
+                groups, members, n = read_hyperedges(fs[0], sep=" ")
+                cat = read_ints(fs[1])
+                cnames = [line.rstrip("\r\n") for line in fs[2]]
+                # Only the users that occur in some group
+                used, members = numpy.unique(members, return_inverse=True)
+                g = bipartite_graph(groups, members, n, len(used), "is_group")
+                g.vp.genre = g.new_vp("string")
+                for i, c in enumerate(cat):
+                    g.vp.genre[g.vertex(len(used) + i)] = cnames[c - 1]
+        yield alt, g