git clone https://github.com/privateer-project/NWDAF-Anomaly-Detection/
cd NWDAF-Anomaly-Detection
git checkout devEnsure you have Python >= 3.9, < 3.12 installed.
python -m venv venv
source venv/bin/activate # For Linux/Mac
# or
venv\Scripts\activate # For WindowsInstall all dependencies from pyproject.toml:
pip install -e .mlflow server --backend-store-uri sqlite:///mlflow.db \
--default-artifact-root ./mlruns \
--host 0.0.0.0 \
--port 5001In the config folder, create a .env file. Copy the content from .env.example (which should live in the same directory as your configuration files). Then update the ROOT_DIR variable to point to the absolute path of the project's root directory.
Here is an example of the variables to include:
ROOT_DIR=<path>/<to>/<project>/<root>/<directory>
ANALYSIS_DIR=${ROOT_DIR}/analysis_results
SCALERS_DIR=${ROOT_DIR}/scalers
MODELS_DIR=${ROOT_DIR}/models
DATA_DIR=${ROOT_DIR}/data
RAW_DIR=${DATA_DIR}/raw
RAW_DATASET=${RAW_DIR}/amari_ue_data_merged_with_attack_number.csv
DATA_URL=https://zenodo.org/api/records/13900057/files-archive
EXPERIMENTS_DIR=${ROOT_DIR}/experiments
PROCESSED_DIR=${DATA_DIR}/processed
FLWR_SERVER_ADDRESS=[::]:8081
MLFLOW_EXPERIMENT_NAME=privateer_ad
MLFLOW_SERVER_ADDRESS=http://localhost:5001
PYTHONPATH=${ROOT_DIR}:${PYTHONPATH}If you plan to train the model on a GPU:
- Verify you have the appropriate CUDA version installed.
- Ensure that your PyTorch version is compatible with your CUDA version.
- Install the GPU-enabled dependencies (e.g.,
torchwith CUDA support).
For example, if you are using CUDA 11.7:
pip install torch==2.0.0+cu117 torchvision==0.15.1+cu117 torchaudio==2.0.0 --extra-index-url https://download.pytorch.org/whl/cu117Additional CUDA versions can be found on the official PyTorch website.
From the project's root directory, run:
PYTHONPATH=./ python privateer_ad/data_utils/download.pyFollowed by:
PYTHONPATH=./ python privateer_ad/data_utils/transform.pyThese commands will create a data folder in the project root with data/raw and data/processed subfolders.
Finally, execute the training script from the root directory:
PYTHONPATH=./ python privateer_ad/train/train.pyMLflow will track experiments and store artifacts in the mlruns directory by default (or any path you configured).