logo Netzschleuder network catalog, repository, and centrifuge

History of yelp_restaurants

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/yelp_restaurants/__init__.py b/entries/yelp_restaurants/__init__.py
index 4b0f145..06bc346 100644
--- a/entries/yelp_restaurants/__init__.py
+++ b/entries/yelp_restaurants/__init__.py
@@ -33,7 +33,7 @@ tags = ['Online', 'Commerce', 'Unweighted', 'Metadata', 'Spatial']
 url = 'https://github.com/jianhao2016/AllSet'
 citation = [('E. Chien, C. Pan, J. Peng, O. Milenkovic, "You are AllSet: A Multiset Function Framework for Hypergraph Neural Networks." International Conference on Learning Representations (ICLR) (2022)', 'https://openreview.net/forum?id=hpBTIv2uy_E'),
             ('Yelp, "Yelp Open Dataset."', 'https://www.yelp.com/dataset')]
-icon_hash = None
+date_added = '2026-10-25'
 upstream_license = ("Yelp Dataset Terms of Use", "https://www.yelp.com/dataset")
 restricted = True
 upstream_prefix = 'https://raw.githubusercontent.com/jianhao2016/AllSet/6281a2f1a91f6f26040777bb0b2578fc035dc57a/data/raw_data'
[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/yelp_restaurants/__init__.py b/entries/yelp_restaurants/__init__.py
index 290c093..4b0f145 100644
--- a/entries/yelp_restaurants/__init__.py
+++ b/entries/yelp_restaurants/__init__.py
@@ -23,9 +23,12 @@ description = """A bipartite network of Yelp users and the restaurants they revi
 
 The network has the following properties:
 
-- `is_user`: whether the node is a user (otherwise it is a restaurant). Users are numbered in the order of their identifiers in the source data.
-- Restaurant nodes: `name`, the name of the restaurant; `stars`, the average star rating of the restaurant's reviews on Yelp, rounded to half stars (1.0 to 5.0); `latitude` and `longitude`, the location of the restaurant, in degrees (as given in the source; one restaurant has a positive longitude, probably a sign error); `city`, `zipcode` and `state`, integer codes for the city, postal code and state or province of the restaurant (the code tables are not available in the source data, so codes can only be compared for equality).
-- User nodes have empty or zero values for the restaurant properties."""
+- (Node) `is_user`: whether the node is a user (otherwise it is a restaurant). Users are numbered in the order of their identifiers in the source data.
+- (Node) `name` (restaurants): the name of the restaurant.
+- (Node) `stars` (restaurants): the average star rating of the restaurant's reviews on Yelp, rounded to half stars (1.0 to 5.0).
+- (Node) `latitude`, `longitude` (restaurants): the location of the restaurant, in degrees (as given in the source; one restaurant has a positive longitude, probably a sign error).
+- (Node) `city`, `zipcode`, `state` (restaurants): integer codes for the city, postal code and state or province of the restaurant (the code tables are not available in the source data, so codes can only be compared for equality).
+- (Node) User nodes have empty or zero values for the restaurant properties."""
 tags = ['Online', 'Commerce', 'Unweighted', 'Metadata', 'Spatial']
 url = 'https://github.com/jianhao2016/AllSet'
 citation = [('E. Chien, C. Pan, J. Peng, O. Milenkovic, "You are AllSet: A Multiset Function Framework for Hypergraph Neural Networks." International Conference on Learning Representations (ICLR) (2022)', 'https://openreview.net/forum?id=hpBTIv2uy_E'),
[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/yelp_restaurants/__init__.py b/entries/yelp_restaurants/__init__.py
index a68997c..290c093 100644
--- a/entries/yelp_restaurants/__init__.py
+++ b/entries/yelp_restaurants/__init__.py
@@ -50,7 +50,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] Remove the remarks on the distribution of the data from the descriptions of beer_reviews, bluesky_failla, citibike, divvy, facebook100, goodreads, hiv_transmission, hollywood_actors, mind_news, movielens_10m_tags, movielens_32m, movielens_ratings, netflix_prize, opensky_flights, opensky_flights_full, regulondb, statsbomb, yelp_restaurants and yelp_reviews by Tiago de Paula Peixoto 8be09c8
The descriptions said whether the data may be distributed (access
tokens, restrictions, redistribution bans, take-downs); the site shows
restricted entries itself, and the descriptions now only describe the
data.
diff --git a/entries/yelp_restaurants/__init__.py b/entries/yelp_restaurants/__init__.py
index 0470be5..a68997c 100644
--- a/entries/yelp_restaurants/__init__.py
+++ b/entries/yelp_restaurants/__init__.py
@@ -25,9 +25,7 @@ The network has the following properties:
 
 - `is_user`: whether the node is a user (otherwise it is a restaurant). Users are numbered in the order of their identifiers in the source data.
 - Restaurant nodes: `name`, the name of the restaurant; `stars`, the average star rating of the restaurant's reviews on Yelp, rounded to half stars (1.0 to 5.0); `latitude` and `longitude`, the location of the restaurant, in degrees (as given in the source; one restaurant has a positive longitude, probably a sign error); `city`, `zipcode` and `state`, integer codes for the city, postal code and state or province of the restaurant (the code tables are not available in the source data, so codes can only be compared for equality).
-- User nodes have empty or zero values for the restaurant properties.
-
-The files of this entry are available only with an access token, since the Yelp Dataset terms forbid sharing the data with third parties."""
+- User nodes have empty or zero values for the restaurant properties."""
 tags = ['Online', 'Commerce', 'Unweighted', 'Metadata', 'Spatial']
 url = 'https://github.com/jianhao2016/AllSet'
 citation = [('E. Chien, C. Pan, J. Peng, O. Milenkovic, "You are AllSet: A Multiset Function Framework for Hypergraph Neural Networks." International Conference on Learning Representations (ICLR) (2022)', 'https://openreview.net/forum?id=hpBTIv2uy_E'),
[entries] Restrict the entries whose upstream terms forbid redistribution by Tiago de Paula Peixoto ddb6c8c
movielens_100k (the MovieLens license forbids redistribution without
permission), and yelp_reviews and yelp_restaurants (the Yelp Dataset terms
forbid sharing the data with third parties) are now restricted: their
files are available only with an access token, as their descriptions now
say. yelp_reviews gets the Yelp Dataset terms as its license.
diff --git a/entries/yelp_restaurants/__init__.py b/entries/yelp_restaurants/__init__.py
index 93a5bd3..0470be5 100644
--- a/entries/yelp_restaurants/__init__.py
+++ b/entries/yelp_restaurants/__init__.py
@@ -25,13 +25,16 @@ The network has the following properties:
 
 - `is_user`: whether the node is a user (otherwise it is a restaurant). Users are numbered in the order of their identifiers in the source data.
 - Restaurant nodes: `name`, the name of the restaurant; `stars`, the average star rating of the restaurant's reviews on Yelp, rounded to half stars (1.0 to 5.0); `latitude` and `longitude`, the location of the restaurant, in degrees (as given in the source; one restaurant has a positive longitude, probably a sign error); `city`, `zipcode` and `state`, integer codes for the city, postal code and state or province of the restaurant (the code tables are not available in the source data, so codes can only be compared for equality).
-- User nodes have empty or zero values for the restaurant properties."""
+- User nodes have empty or zero values for the restaurant properties.
+
+The files of this entry are available only with an access token, since the Yelp Dataset terms forbid sharing the data with third parties."""
 tags = ['Online', 'Commerce', 'Unweighted', 'Metadata', 'Spatial']
 url = 'https://github.com/jianhao2016/AllSet'
 citation = [('E. Chien, C. Pan, J. Peng, O. Milenkovic, "You are AllSet: A Multiset Function Framework for Hypergraph Neural Networks." International Conference on Learning Representations (ICLR) (2022)', 'https://openreview.net/forum?id=hpBTIv2uy_E'),
             ('Yelp, "Yelp Open Dataset."', 'https://www.yelp.com/dataset')]
 icon_hash = None
 upstream_license = ("Yelp Dataset Terms of Use", "https://www.yelp.com/dataset")
+restricted = True
 upstream_prefix = 'https://raw.githubusercontent.com/jianhao2016/AllSet/6281a2f1a91f6f26040777bb0b2578fc035dc57a/data/raw_data'
 _d = 'AllSet_all_raw_data.zip:AllSet_all_raw_data/yelp/'
 files = [((_d + 'yelp_restaurant_incidence_H.csv',
[entries] New entry: yelp_restaurants by Tiago de Paula Peixoto f71a261
diff --git a/entries/yelp_restaurants/__init__.py b/entries/yelp_restaurants/__init__.py
new file mode 100644
index 0000000..93a5bd3
--- /dev/null
+++ b/entries/yelp_restaurants/__init__.py
@@ -0,0 +1,97 @@
+#! /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 = "Yelp users and restaurants (AllSet, 2021)"
+description = """A bipartite network of Yelp users and the restaurants they reviewed, compiled by Chien et al. from the Yelp Open Dataset (a subset of Yelp's businesses, reviews and users released by Yelp for academic use) as a benchmark for node classification. All businesses in Yelp's "Restaurants" category were selected, and each user is connected to the restaurants they reviewed (the compilers describe them as restaurants "visited by the same user"). Every user is connected to at least two restaurants. The restaurants are located in 459 cities and 16 states or provinces of North America; the identities of the users and businesses in the original data are not included, and the version of the Yelp Open Dataset that was used is not stated.
+
+The network has the following properties:
+
+- `is_user`: whether the node is a user (otherwise it is a restaurant). Users are numbered in the order of their identifiers in the source data.
+- Restaurant nodes: `name`, the name of the restaurant; `stars`, the average star rating of the restaurant's reviews on Yelp, rounded to half stars (1.0 to 5.0); `latitude` and `longitude`, the location of the restaurant, in degrees (as given in the source; one restaurant has a positive longitude, probably a sign error); `city`, `zipcode` and `state`, integer codes for the city, postal code and state or province of the restaurant (the code tables are not available in the source data, so codes can only be compared for equality).
+- User nodes have empty or zero values for the restaurant properties."""
+tags = ['Online', 'Commerce', 'Unweighted', 'Metadata', 'Spatial']
+url = 'https://github.com/jianhao2016/AllSet'
+citation = [('E. Chien, C. Pan, J. Peng, O. Milenkovic, "You are AllSet: A Multiset Function Framework for Hypergraph Neural Networks." International Conference on Learning Representations (ICLR) (2022)', 'https://openreview.net/forum?id=hpBTIv2uy_E'),
+            ('Yelp, "Yelp Open Dataset."', 'https://www.yelp.com/dataset')]
+icon_hash = None
+upstream_license = ("Yelp Dataset Terms of Use", "https://www.yelp.com/dataset")
+upstream_prefix = 'https://raw.githubusercontent.com/jianhao2016/AllSet/6281a2f1a91f6f26040777bb0b2578fc035dc57a/data/raw_data'
+_d = 'AllSet_all_raw_data.zip:AllSet_all_raw_data/yelp/'
+files = [((_d + 'yelp_restaurant_incidence_H.csv',
+           _d + 'yelp_restaurant_name.csv',
+           _d + 'yelp_restaurant_business_stars.csv',
+           _d + 'yelp_restaurant_latlong.csv',
+           _d + 'yelp_restaurant_locations.csv'),
+          None, 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]
+
+            # Incidences: header "he,node,val", with 1-based user ("he") and
+            # restaurant ("node") ids written as floats; val is always 1
+            next(fs[0])
+            H = numpy.array(fs[0].read().replace(",", " ").split(),
+                            dtype=float).reshape(-1, 3).astype(numpy.int64)
+            groups = H[:, 0] - 1
+            members = H[:, 1] - 1
+
+            # Restaurant attributes, one row per restaurant, in id order
+            rows = list(csv.reader(fs[1]))[1:]
+            names = [r[0] for r in rows]
+            stars = [int(l) for l in list(fs[2])[1:]]
+            latlong = [r for r in csv.reader(fs[3])][1:]
+            locs = [r for r in csv.reader(fs[4])][1:]
+
+            N = len(names)
+            assert N == len(stars) == len(latlong) == len(locs)
+            assert members.max() < N
+            g = bipartite_graph(groups, members, groups.max() + 1, N, "is_user")
+
+            g.vp.name = g.new_vp("string")
+            for v in range(N):
+                g.vp.name[v] = names[v]
+            g.vp.stars = g.new_vp("double")
+            # stars are given as twice the star rating (2 to 10)
+            g.vp.stars.a[:N] = numpy.array(stars) / 2
+            g.vp.latitude = g.new_vp("double")
+            g.vp.longitude = g.new_vp("double")
+            ll = numpy.array(latlong, dtype=float)
+            g.vp.latitude.a[:N] = ll[:, 0]
+            g.vp.longitude.a[:N] = ll[:, 1]
+            loc = numpy.array(locs, dtype=numpy.int64)
+            for i, k in enumerate(["city", "zipcode", "state"]):
+                g.vp[k] = g.new_vp("int")
+                g.vp[k].a[:N] = loc[:, i]
+        yield alt, g