Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
This fixes numerous issues causing CI to fail. None of them stopped the models
working.

- Update the `MovieLens` dataset to specify an encoding
  (https://en.wikipedia.org/wiki/ISO/IEC_8859-1 in particular), because the
  file contains some invalid UTF-8, in the form of rows in `u.item` such as
  `Misérables, Les (1995)|...`, where the `é` is encoded as `E9`, instead of
  `C3 A9` (see https://en.wikipedia.org/wiki/%C3%89#Character_mappings). This
  started failing when pandas 1.2.0 was released (it passed with 1.1.5), and
  the relevant changelog
  (https://pandas.pydata.org/pandas-docs/stable/whatsnew/v1.2.0.html#i-o) might
  be (unclear, though):

   > to_csv() and read_csv() did not honor compression and encoding for
   > path-like objects that are internally converted to file-like objects
   > (GH35677, GH26124, GH32392)

- Remove the `with_labels` argument from `nx.draw_networkx_nodes` calls
  (https://networkx.org/documentation/stable/reference/generated/networkx.drawing.nx_pylab.draw_networkx_nodes.html#networkx.drawing.nx_pylab.draw_networkx_nodes),
  which always did nothing and were just being grouped into the unused `**kwds`
  dictionary in NetworkX 2.4 and earlier. NetworkX 2.5 removes this dictionary
  and so the argument cannot be specified.  (I suspect it was inherited from
  `nx.draw_networkx`
  (https://networkx.org/documentation/stable/reference/generated/networkx.drawing.nx_pylab.draw_networkx.html),
  which does support `with_labels`.)  Relevant changelog
  (https://networkx.org/documentation/stable/release/release_2.5.html#api-changes):

  > all keywords are now checked for validity in nx.draw and friends

  Fixes stellargraph#1798

- Switch to appending directories to path via the file referred to by
  `$GITHUB_PATH`, because GitHub stopped using the special printed `::add-path`
  command. Relevant changelogs:
  - https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
  - https://github.blog/changelog/2020-11-09-github-actions-removing-set-env-and-add-path-commands-on-november-16/

- Force `__file__` to be relative to the root of the repo
  `scripts/demo_indexing.py`, because it changed to be the absolute path,
  rather than the path relative to the root of the repo, unsure why.

- Switch `validation_data=[data, labels]` to `validation_data=(data, labels)`
  (a tuple) in GCN-LSTM demo, because TensorFlow 2.4 changed the behaviour of
  `model.fit(..., validation_data=...)`, to require a tuple to get that
  behaviour (the list version tries to use the list as inputs). Potentially
  relevant changelog
  (https://github.com/tensorflow/tensorflow/releases/tag/v2.4.0) (unclear):

  > For Keras model, the individual call of Model.evaluate uses no cached data
  > for evaluation, while Model.fit uses cached data when validation_data arg
  > is provided for better performance.

- Remove the `port=None` (and `user` and `password`) arguments from the
  `py2neo.Graph` constructor call, because py2neo 2020.0.0 changed how the
  `Graph(...)` constructor handles them: in particular, `port=None` tries to
  use `None` as the port, rather than the default value. py2neo doesn't seem to
  publish a changelog. Fixes stellargraph#1743.

- Use `python-version: '3.8'` for `setup-python` on CI, because Python 3.9 was
  released, and the `'3.x'` constraing was using it. There isn't a TensorFlow
  release for 3.9 yet, so installation would fail in the general checkers using
  this constraint.

- Switch to explicit `runner: ubuntu-18.04` on CI, because Github upgraded the
  `ubuntu-latest` runner version from Ubuntu 18.04 to Ubuntu 20.04, which
  caused two steps to fail:

  - the copyright header checking starts failing for an unknown and
    non-described reason in the `find` invocation
  - building the documentation fails the spell-checking step, seemingly because
    the `en_AU` dictionary cannot be found, and instead it's using US spelling
    for `visualisation` etc.

  Relevant changelog:
  https://github.blog/changelog/2020-10-29-github-actions-ubuntu-latest-workflows-will-use-ubuntu-20-04/
  • Loading branch information
huonw authored Jan 12, 2021
1 parent ec13264 commit db0e2f7
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 40 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ jobs:
run: |
python3 -m pip install --upgrade pip
python3 -m pip install black==19.10b0
echo ::add-path::$HOME/.local/bin
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Check formatting
run: |
if ! black --check --diff . ; then
Expand All @@ -319,7 +319,7 @@ jobs:
filter_mode: file

copyright:
runs-on: ubuntu-latest
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -369,7 +369,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.x"
python-version: "3.8"

- name: Install requirements
run: |
Expand All @@ -386,7 +386,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.x"
python-version: "3.8"

- name: Install requirements
run: |
Expand Down Expand Up @@ -450,7 +450,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.x"
python-version: "3.8"

- name: Install requirements
run: |
Expand All @@ -461,14 +461,14 @@ jobs:
run: python scripts/demo_indexing.py --action=compare

check-documentation:
runs-on: ubuntu-latest
runs-on: ubuntu-18.04
env:
sphinx_opts: "-W --keep-going"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.x"
python-version: "3.8"

- name: Install pandoc
run: |
Expand Down
4 changes: 2 additions & 2 deletions demos/basics/loading-saving-neo4j.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@
"\n",
"default_host = os.environ.get(\"STELLARGRAPH_NEO4J_HOST\")\n",
"\n",
"# Create the Neo4j Graph database object; the parameters can be edited to specify location and authentication\n",
"neo4j_graph = py2neo.Graph(host=default_host, port=None, user=None, password=None)"
"# Create the Neo4j Graph database object; port, user, password parameters can be add to specify location and authentication\n",
"neo4j_graph = py2neo.Graph(host=default_host)"
]
},
{
Expand Down
8 changes: 2 additions & 6 deletions demos/community_detection/attacks_clustering_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -882,9 +882,7 @@
"\n",
"fig, ax = plt.subplots(figsize=(12, 6))\n",
"nx.draw_networkx_edges(com_G, pos, edge_color=\"grey\")\n",
"nx.draw_networkx_nodes(\n",
" com_G, pos, nodelist=nodes, with_labels=True, node_size=200, alpha=0.5\n",
")\n",
"nx.draw_networkx_nodes(com_G, pos, nodelist=nodes, node_size=200, alpha=0.5)\n",
"nx.draw_networkx_labels(com_G, pos, font_color=\"#362626\", font_size=50)\n",
"mplleaflet.display(fig=ax.figure)"
]
Expand Down Expand Up @@ -3042,9 +3040,7 @@
"\n",
"fig, ax = plt.subplots(figsize=(22, 12))\n",
"\n",
"nx.draw_networkx_nodes(\n",
" cluster_G, pos, nodelist=nodes, with_labels=True, node_size=200, alpha=0.5\n",
")\n",
"nx.draw_networkx_nodes(cluster_G, pos, nodelist=nodes, node_size=200, alpha=0.5)\n",
"nx.draw_networkx_labels(cluster_G, pos, font_color=\"red\", font_size=50)\n",
"nx.draw_networkx_edges(cluster_G, pos, edge_color=\"grey\")\n",
"\n",
Expand Down
5 changes: 2 additions & 3 deletions demos/connector/neo4j/cluster-gcn-on-cora-neo4j-example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@
"source": [
"default_host = os.environ.get(\"STELLARGRAPH_NEO4J_HOST\")\n",
"\n",
"# Create the Neo4j Graph database object;\n",
"# the arguments can be edited to specify location and authentication\n",
"graph = py2neo.Graph(host=default_host, port=None, user=None, password=\"pass\")\n",
"# Create the Neo4j Graph database object; port, user, password parameters can be add to specify location and authentication\n",
"graph = py2neo.Graph(host=default_host)\n",
"neo4j_sg = Neo4jStellarGraph(graph)"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
"\n",
"default_host = os.environ.get(\"STELLARGRAPH_NEO4J_HOST\")\n",
"\n",
"# Create the Neo4j Graph database object; the arguments can be edited to specify location and authentication\n",
"neo4j_graphdb = py2neo.Graph(host=default_host, port=None, user=None, password=None)"
"# Create the Neo4j Graph database object; port, user, password parameters can be add to specify location and authentication\n",
"neo4j_graphdb = py2neo.Graph(host=default_host)"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions demos/connector/neo4j/load-cora-into-neo4j.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@
"\n",
"default_host = os.environ.get(\"STELLARGRAPH_NEO4J_HOST\")\n",
"\n",
"# Create the Neo4j Graph database object; the arguments can be edited to specify location and authentication\n",
"graph = py2neo.Graph(host=default_host, port=None, user=None, password=None)"
"# Create the Neo4j Graph database object; port, user, password parameters can be add to specify location and authentication\n",
"graph = py2neo.Graph(host=default_host)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
"\n",
"default_host = os.environ.get(\"STELLARGRAPH_NEO4J_HOST\")\n",
"\n",
"# Create the Neo4j Graph database object; the arguments can be edited to specify location and authentication\n",
"neo4j_graphdb = py2neo.Graph(host=default_host, port=None, user=None, password=None)"
"# Create the Neo4j Graph database object; port, user, password parameters can be add to specify location and authentication\n",
"neo4j_graphdb = py2neo.Graph(host=default_host)"
]
},
{
Expand Down
4 changes: 0 additions & 4 deletions demos/interpretability/gat-node-link-importance.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,6 @@
" node_color=positive_colors,\n",
" cmap=cmap,\n",
" node_size=positive_node_sizes,\n",
" with_labels=False,\n",
" vmin=np.min(colors) - 0.5,\n",
" vmax=np.max(colors) + 0.5,\n",
" node_shape=\"o\",\n",
Expand All @@ -875,7 +874,6 @@
" node_color=negative_colors,\n",
" cmap=cmap,\n",
" node_size=negative_node_sizes,\n",
" with_labels=False,\n",
" vmin=np.min(colors) - 0.5,\n",
" vmax=np.max(colors) + 0.5,\n",
" node_shape=\"d\",\n",
Expand Down Expand Up @@ -1025,7 +1023,6 @@
" node_color=positive_colors,\n",
" cmap=cmap,\n",
" node_size=positive_node_sizes,\n",
" with_labels=False,\n",
" vmin=np.min(colors) - 0.5,\n",
" vmax=np.max(colors) + 0.5,\n",
" node_shape=\"o\",\n",
Expand All @@ -1037,7 +1034,6 @@
" node_color=negative_colors,\n",
" cmap=cmap,\n",
" node_size=negative_node_sizes,\n",
" with_labels=False,\n",
" vmin=np.min(colors) - 0.5,\n",
" vmax=np.max(colors) + 0.5,\n",
" node_shape=\"d\",\n",
Expand Down
4 changes: 0 additions & 4 deletions demos/interpretability/gcn-node-link-importance.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,6 @@
" node_color=positive_colors,\n",
" cmap=cmap,\n",
" node_size=positive_node_sizes,\n",
" with_labels=False,\n",
" vmin=np.min(colors) - 0.5,\n",
" vmax=np.max(colors) + 0.5,\n",
" node_shape=\"o\",\n",
Expand All @@ -913,7 +912,6 @@
" node_color=negative_colors,\n",
" cmap=cmap,\n",
" node_size=negative_node_sizes,\n",
" with_labels=False,\n",
" vmin=np.min(colors) - 0.5,\n",
" vmax=np.max(colors) + 0.5,\n",
" node_shape=\"d\",\n",
Expand Down Expand Up @@ -1054,7 +1052,6 @@
" node_color=positive_colors,\n",
" cmap=cmap,\n",
" node_size=positive_node_sizes,\n",
" with_labels=False,\n",
" vmin=np.min(colors) - 0.5,\n",
" vmax=np.max(colors) + 0.5,\n",
" node_shape=\"o\",\n",
Expand All @@ -1066,7 +1063,6 @@
" node_color=negative_colors,\n",
" cmap=cmap,\n",
" node_size=negative_node_sizes,\n",
" with_labels=False,\n",
" vmin=np.min(colors) - 0.5,\n",
" vmax=np.max(colors) + 0.5,\n",
" node_shape=\"d\",\n",
Expand Down
4 changes: 0 additions & 4 deletions demos/interpretability/gcn-sparse-node-link-importance.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,6 @@
" node_color=positive_colors,\n",
" cmap=cmap,\n",
" node_size=positive_node_sizes,\n",
" with_labels=False,\n",
" vmin=np.min(colors) - 0.5,\n",
" vmax=np.max(colors) + 0.5,\n",
" node_shape=\"o\",\n",
Expand All @@ -875,7 +874,6 @@
" node_color=negative_colors,\n",
" cmap=cmap,\n",
" node_size=negative_node_sizes,\n",
" with_labels=False,\n",
" vmin=np.min(colors) - 0.5,\n",
" vmax=np.max(colors) + 0.5,\n",
" node_shape=\"d\",\n",
Expand Down Expand Up @@ -1028,7 +1026,6 @@
" node_color=positive_colors,\n",
" cmap=cmap,\n",
" node_size=positive_node_sizes,\n",
" with_labels=False,\n",
" vmin=np.min(colors) - 0.5,\n",
" vmax=np.max(colors) + 0.5,\n",
" node_shape=\"o\",\n",
Expand All @@ -1040,7 +1037,6 @@
" node_color=negative_colors,\n",
" cmap=cmap,\n",
" node_size=negative_node_sizes,\n",
" with_labels=False,\n",
" vmin=np.min(colors) - 0.5,\n",
" vmax=np.max(colors) + 0.5,\n",
" node_shape=\"d\",\n",
Expand Down
2 changes: 1 addition & 1 deletion demos/time-series/gcn-lstm-time-series.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@
" batch_size=60,\n",
" shuffle=True,\n",
" verbose=0,\n",
" validation_data=[testX, testY],\n",
" validation_data=(testX, testY),\n",
")"
]
},
Expand Down
4 changes: 1 addition & 3 deletions scripts/demo_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
LINK_DEFAULT_TEXT = "demo"
TRUE_TEXT = "yes"
DOC_URL_BASE = "https://stellargraph.readthedocs.io/en/stable"
AUTOGENERATED_PROMPT = (
f"autogenerated by {__file__}, edit that file instead of this location"
)
AUTOGENERATED_PROMPT = f"autogenerated by {os.path.relpath(__file__)}, edit that file instead of this location"
DOCS_LINK_SEPARATOR = "\n<!-- DOCS LINKS -->\n"


Expand Down
1 change: 1 addition & 0 deletions stellargraph/datasets/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ def load(self):
header=None,
names=movie_columns,
usecols=["movie_id"] + movie_columns[5:],
encoding="iso-8859-1",
)

# manage the IDs
Expand Down

0 comments on commit db0e2f7

Please sign in to comment.