diff --git a/README.md b/README.md
index d2c504e..a62a9fe 100644
--- a/README.md
+++ b/README.md
@@ -26,10 +26,6 @@ If you feel this book is for you, get your [copy](https://www.amazon.com/dp/1800
-## Errata
-Page 16
-
-The expression nt.to.numpy.matrix(G) should be nx.to.numpy.matrix(G)
## Instructions and Navigations
All of the code is organized into folders. For example, Chapter02.
@@ -44,6 +40,15 @@ generator = HinSAGENodeGenerator(
head_node_type="document"
)
```
+
+The notebooks in the repositories save files and figures into dedicated folders as they are executed. The format for these folders are:
+
+```
+/Chapter
+```
+
+where `DATA_FOLDER` is an environment variable that you can use to customize the position for the data. If the variable is not set, its value fall back to `/data`.
+
**Following is what you need for this book:**
This book is for data analysts, graph developers, graph analysts, and graph professionals who want to leverage the information embedded in the connections and relations between data points to boost their analysis and model performance. The book will also be useful for data scientists and machine learning developers who want to build ML-driven graph databases. A beginner-level understanding of graph databases and graph data is required. Intermediate-level working knowledge of Python programming and machine learning is also expected to make the most out of this book.
diff --git a/docker/Dockerfile b/docker/Dockerfile
index f9eb2e3..47d1e37 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -15,6 +15,7 @@ USER ${user}
ENV HOME /home/${user}
ENV NB_USER=${user}
ENV XDG_CACHE_HOME=/home/${user}/.cache/
+ENV DATA_FOLDER=/data
RUN git clone https://github.com/deusebio/Graph-Machine-Learning.git /home/${user}/Graph-Machine-Learning
WORKDIR /home/${user}/Graph-Machine-Learning
diff --git a/docker/README.md b/docker/README.md
index d062fc7..cfd50d5 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -32,7 +32,7 @@ $ docker run --rm \
graph-machine-learning:latest
```
-to start the image. We suggest to use the default port 8888 for the ``. This will start a Jupyter server which should be locally accessible at `[http://localhost:8888](http://localhost:8888)` (or change the port accordingly).
+to start the image. Please make sure that the data folder can be written by the Docker image. We suggest to use the default port 8888 for the ``. This will start a Jupyter server which should be locally accessible at `[http://localhost:8888](http://localhost:8888)` (or change the port accordingly).
## For Developers
diff --git a/utils.py b/utils.py
index b9a368a..a524daf 100644
--- a/utils.py
+++ b/utils.py
@@ -6,7 +6,12 @@
_chapter = os.path.basename(os.getcwd())
-DATA_DIR = pathlib.Path("/") / "data" / _chapter
+if _chapter.startswith("Chapter"):
+ BASE_FOLDER = os.environ.get("DATA_FOLDER", os.path.join(os.getcwd(), "..", "data"))
+ DATA_DIR = pathlib.Path(BASE_FOLDER) / _chapter
+else:
+ BASE_FOLDER = os.environ.get("DATA_FOLDER", os.getcwd())
+ DATA_DIR = pathlib.Path(BASE_FOLDER)
FIGURES_DIR = DATA_DIR / "figures"
@@ -65,4 +70,4 @@ def draw_enhanced_path(G, path_to_enhance, node_names={}, filename=None, layout
axis.set_ylim([1.2*y for y in axis.get_ylim()])
if filename:
- plt.savefig(FIGURES_DIR / filename, format="png")
\ No newline at end of file
+ plt.savefig(FIGURES_DIR / filename, format="png")