` if you don't have it)
pyenv local 3.10.13
# Tell poetry to use python 3.10
poetry env use 3.10.13
# Install
poetry install
```
## Dataset Preparation
You can download the TON_IoT dataset by accessing the following [link](https://research.unsw.edu.au/projects/toniot-datasets). Please navigate to `TON_IoT datasets/Train_Test_datasets/Train_Test_Linux_dataset` and download the file `Train_test_linux_memory.csv`. Then, rename the downloaded file to `dataset.csv` and place it in the `dataset/` directory. If you want to run the experiments with your own data, ensure your dataset is also named `dataset.csv` and located in the same directory. The dataset is preprocessed using `dataset_preparation.py`, which you can modify if you wish to add custom preprocessing steps.
## Running the Experiments
To run StatAvg with TON IoT baseline, ensure you have activated your Poetry environment (execute `poetry shell` from this directory), then:
```bash
python -m statavg.main # this will run using the default settings in the `conf/base.yaml`
# you can override settings directly from the command line
python -m statavg.main num_rounds=20 # will set number of rounds to 20
```
It is noted that an auxiliary directory is created in the runtime to persist client state, which includes the data scalers/normalizers of each client. By default, this directory is deleted upon the termination of the execution. To prevent automatic deletion (in this case, it is recommended to manually delete the directory from previous runs), execute the following:
```bash
# disable automated removal of the auxiliary directory of scalers
python -m statavg.main delete_scaler_dir=False
```
## Expected Results
To reproduce the results of the paper (Fig. 3., StatAvg), simply run:
```bash
python -m statavg.main # default settings
```
You can also reproduce the results with FedAvg as a baseline by running:
```bash
python -m statavg.main --config-name fedavg # run with FedAvg
```
The expected results should look similar to the following figure:
Testing Accuracy vs Rounds for StatAvg
It is noted that the results are saved into a pickle file in the directory `outputs/`, which will be automatically created when the experiments are run.
In the paper, server-side evaluation is not implemented, as it is considered that the server does not own any data. However, it can be enabled by executing:
```bash
# enable server-side evaluation with the data ratio of your preference. Default settings do not include this option.
python -m statavg.main include_testset.flag=true include_testset.ratio=0.15
```
Disclaimer: Please note that the results presented above differ from those in the paper. Since the experiments for the paper were conducted, the dataset authors have made slight modifications to the dataset. Although these changes result in a decrease in accuracy (approximately a 10% drop), `StatAvg` is still expected to consistently outperform `FedAvg`, as demonstrated in the paper.