- python3
- pip
Install project dependecies:
pip install -r requirements.txt
The project structure is organized as follow:
- data: Contains the RNP graph, traffic data and geographical data.
- results: Contains the model weights, training information. Additionally, it includes comparative graphics between the models using different metrics.
- src: Contains the source code.
- configs: Contains the configurations used for each model.
The training and evaluation of the models consist of the following steps:
-
First, the models are configured using the
Config
class insrc/config.py
and then added to thetrain_models.py
file. Sample configurations can be viewed in theconfigs/
directory. -
The configurations are loaded using the
ModelLauncher
class insrc/model_launcher.py
. This class creates the model with the respective configurations and then performs training, saving the results such as losses, final load prediction, model weights, and model name in theresults/
directory. -
Finally, the script
plot_graphics.py
is executed. The data saved in the previous step is loaded, and metrics such as MAE (Mean Absolute Error), MSE (Mean Squared Error), and R²(Coefficient of Determination) are calculated. The graphics containing these metrics are saved in theresults/
directory.
To simplify the reproduction of the experiments, a shell script (run_experiments.sh
) has been provided in the root folder of the project. This script will execute the Python script train_models.py
, and at the end, the script plot_graphics.py
is run to evaluate the models and generate the graphics. The training progress can be monitored through the terminal.
To execute the shell script, make sure it has execution permission, and if so, run:
./run_experiments.sh
If this file does not have execution permission, execute the command below, and then run the previous command:
chmod +x run_experiments.sh
Our tool allows the inclusion of custom GNN models for training and testing on the RNP network by following these steps:
-
Create your model in
src/models/
. -
Define your model and its configuration in the
configs/
directory using theConfig
class. Note that you should choose a class to encapsulate your data.2.a. If your model is a traditional GNN, i.e., it only needs node features and edge indices, you can use the
GNNData
class.2.b. If it also uses edge features, use the
EdgeGNNData
class.2.c. Otherwise, you can create your own data class from the
DataInterface
interface, as done for theCAGNNData
class. These classes can be found insrc/entities
.2.d. Note also that you need to define a function to load the network graph data, which will be used to initialize the data class (an extension of
DataInterface
). Use the implemented configurations as a reference. -
Add your configuration class to
train_models.py
. -
If you have already run the experiments, execute the training in
train_models.py
only for your model and run theplot_graphics.py
script. Otherwise, run therun_experiments.sh
including your model. -
View the graphics in the
results/
folder.