# ARFU-IDS: Reference Commands Matching the Anonymous Repository

# Run these commands from the root directory of the anonymized GitHub repository.
# Replace /path/to/data with the local directory containing the downloaded public datasets.
# The supplementary archive provides reported logs, raw per-seed values, and confidence intervals;
# the anonymized GitHub repository provides executable scripts and modules.

# -- Environment ---------------------------------------------------------------
conda create -n arfuids python=3.10 -y
conda activate arfuids
pip install -r requirements.txt
pip install -e .


# -- Public dataset preparation examples ---------------------------------------
# Place downloaded datasets under:
#   data/raw/unsw_nb15/
#   data/raw/ciciot2023/
#   data/raw/iotid20/

python -m scripts.prepare_data --config configs/unsw_nb15.yaml
python -m scripts.prepare_data --config configs/ciciot2023.yaml
python -m scripts.prepare_data --config configs/iotid20.yaml

# -- Federated IDS training ----------------------------------------------------
python -m scripts.run_fl_train --config configs/unsw_nb15.yaml --out runs/unsw_nb15_seed42
python -m scripts.run_fl_train --config configs/ciciot2023.yaml --out runs/ciciot2023_seed42
python -m scripts.run_fl_train --config configs/iotid20.yaml --out runs/iotid20_seed42

# -- ARFU-IDS single-client unlearning -----------------------------------------
# auto selects the client with the highest aggregate local proportion of samples belonging to the predefined rare-category set.
python -m scripts.run_unlearn --config configs/unsw_nb15.yaml --checkpoint runs/unsw_nb15_seed42/global_model.pt --out runs/unsw_nb15_arfu_seed42 --target-client auto

# -- ARFU-IDS concurrent unlearning --------------------------------------------
# auto3 selects the top three clients by the aggregate local proportion of samples belonging to the predefined rare-category set.
# The scheduler computes AHAG conflict-head sets and uses Jaccard overlap for conflict-graph coloring.
python -m scripts.run_unlearn --config configs/unsw_nb15.yaml --checkpoint runs/unsw_nb15_seed42/global_model.pt --out runs/unsw_nb15_arfu_3clients_seed42 --target-client auto3

# -- Regenerate confidence intervals from reported per-seed CSV ----------------
# The following command uses a script from the anonymized GitHub repository;
# that executable script is not included in this supplementary archive.
python -m scripts.regenerate_tables --raw results/reported/raw_results_reported_experiments_all_seeds.csv --out results/reported/regenerated_confidence_intervals.csv

# The supplementary archive stores the reported per-seed CSVs and logs under:
#   results/raw_results_reported_experiments_all_seeds.csv
#   ../confidence_intervals_95pct.csv  (Table S1 at the supplementary-package root)
#   results/per_round_logs/
