From 2e11833671549b321491dc4c3d3f4e22e2673015 Mon Sep 17 00:00:00 2001
From: Neea Rusch <2580981+nkrusch@users.noreply.github.com>
Date: Thu, 23 Nov 2023 20:30:21 -0500
Subject: [PATCH] rename algo (#68)
---
README.md | 31 +++++++++++++++----------------
{algo => cge}/__init__.py | 2 +-
{algo => cge}/types.py | 0
{algo => cge}/validation.py | 0
exp/__init__.py | 2 +-
exp/__main__.py | 2 +-
test/test_validation.py | 2 +-
7 files changed, 19 insertions(+), 20 deletions(-)
rename {algo => cge}/__init__.py (73%)
rename {algo => cge}/types.py (100%)
rename {algo => cge}/validation.py (100%)
diff --git a/README.md b/README.md
index 9bfb227..ef0037b 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,14 @@
-# Constrained adversarial attacks
+# Constrained adversarial evasion attacks
[![Build](https://github.com/aucad/new-experiments/actions/workflows/build.yml/badge.svg)](https://github.com/aucad/new-experiments/actions/workflows/build.yml)
This implementation demonstrates an approach to introduce constraints to unconstrained adversarial machine learning evasion attacks.
-We introduce a _constraint validation_ algorithm that guarantees generated evasive adversarial examples satisfy domain constraints.
-We call evasive examples that satisfy domain constraints _valid_.
+We introduce a _constraint validation_ algorithm, CGE, that guarantees generated evasive adversarial examples satisfy domain constraints.
This implementation allows running various adversarial evasion attacks, enhanced with our constraint validation algorithm, on different data sets and classifiers.
The following options are included.
-- **Attacks**: Projected Gradient Descent (PGD), Zeroth-Order Optimization (ZOO), HopSkipJump attack. These attacks are modified to use our constraint validation algorithm.
+- **Attacks**: Projected Gradient Descent (PGD), Zeroth-Order Optimization (ZOO), HopSkipJump attack. These attacks are modified to use CGE.
- **Classifiers**: Keras deep neural network and tree-based ensemble XGBoost.
- **Data sets**: 4 different data sets from different domains.
@@ -29,7 +28,7 @@ It uses a different constraint evaluation approach, introduced by [Simonetto et
The input data must be numeric and parse to a numeric type (NULL
should be a null, not -
, etc.).
Categorical attributes must be one-hot encoded.
Data sets should not be normalized, because this will be done automatically (otherwise the constraints must include manual scaling).
-All data sets have an equal 50/50 class distribution.
+All data sets have 50/50 class label distribution.
The provided sampled data sets were generated by random sampling, without replacement, using Weka's supervised instance SpreadSubsample.
@@ -130,17 +129,17 @@ python3 -m plot --help
### Repository organization
-| Directory | Description |
-|:-------------|:-----------------------------------------------|
-| `.github` | Automated workflows, dev instructions |
-| `algo` | Constraint validation algorithm implementation |
-| `comparison` | C-PGD attack implementation |
-| `config` | Experiment configuration files |
-| `data` | Preprocessed input data sets |
-| `exp` | Source code for running experiments |
-| `plot` | Utilities for plotting experiment results |
-| `ref_result` | Referential result for comparison |
-| `test` | Unit tests |
+| Directory | Description |
+|:-------------|:------------------------------------------|
+| `.github` | Automated workflows, dev instructions |
+| `cge` | CGE algorithm implementation |
+| `comparison` | C-PGD attack implementation |
+| `config` | Experiment configuration files |
+| `data` | Preprocessed input data sets |
+| `exp` | Source code for running experiments |
+| `plot` | Utilities for plotting experiment results |
+| `ref_result` | Referential result for comparison |
+| `test` | Unit tests |
- The Makefile contains pre-configured commands to ease running experiments.
- All software dependencies are listed in `requirements.txt`.
diff --git a/algo/__init__.py b/cge/__init__.py
similarity index 73%
rename from algo/__init__.py
rename to cge/__init__.py
index 4214f8c..301a644 100644
--- a/algo/__init__.py
+++ b/cge/__init__.py
@@ -1,7 +1,7 @@
# flake8: noqa: F401
"""
-Constraints enforcing algorithm.
+Constraints Guaranteed Evasion (CGE) algorithm.
"""
# noinspection PyPep8
diff --git a/algo/types.py b/cge/types.py
similarity index 100%
rename from algo/types.py
rename to cge/types.py
diff --git a/algo/validation.py b/cge/validation.py
similarity index 100%
rename from algo/validation.py
rename to cge/validation.py
diff --git a/exp/__init__.py b/exp/__init__.py
index 6c78fb1..b564425 100644
--- a/exp/__init__.py
+++ b/exp/__init__.py
@@ -16,7 +16,7 @@
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# noinspection PyPep8
-from algo import Validatable, CONSTR_DICT, Validation
+from cge import Validatable, CONSTR_DICT, Validation
from exp.machine import machine_details
from exp.utility import ensure_dir
from exp.scoring import Result, ModelScore, AttackScore, score_valid
diff --git a/exp/__main__.py b/exp/__main__.py
index fba2282..f6c7dce 100644
--- a/exp/__main__.py
+++ b/exp/__main__.py
@@ -1,7 +1,7 @@
import sys
from argparse import ArgumentParser
-from algo.validation import ALL as RESET_ALL
+from cge.validation import ALL as RESET_ALL
from exp import Experiment, AttackPicker, ClsPicker
from exp.preproc import pred_parse
from exp.utility import to_namedtuple, read_yaml
diff --git a/test/test_validation.py b/test/test_validation.py
index ea6dc30..d3390a5 100644
--- a/test/test_validation.py
+++ b/test/test_validation.py
@@ -1,5 +1,5 @@
import numpy as np
-from algo.validation import Validation, ALL, DEP
+from cge.validation import Validation, ALL, DEP
from plot.graph import dep_graph