Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
rename algo (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkrusch authored Nov 24, 2023
1 parent cdae81d commit 2e11833
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 20 deletions.
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -29,7 +28,7 @@ It uses a different constraint evaluation approach, introduced by [Simonetto et
<li>The input data must be numeric and parse to a numeric type (<code>NULL</code> should be a null, not <code>-</code>, etc.).</li>
<li>Categorical attributes must be one-hot encoded.</li>
<li>Data sets should not be normalized, because this will be done automatically (otherwise the constraints must include manual scaling).</li>
<li>All data sets have an equal 50/50 class distribution.</li>
<li>All data sets have 50/50 class label distribution.</li>
<li>The provided sampled data sets were generated by random sampling, without replacement, using Weka's supervised instance <a href="https://waikato.github.io/weka-blog/posts/2019-01-30-sampling/" target="_blank">SpreadSubsample</a>.</li>
</ul>
</details>
Expand Down Expand Up @@ -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`.
2 changes: 1 addition & 1 deletion algo/__init__.py → cge/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# flake8: noqa: F401

"""
Constraints enforcing algorithm.
Constraints Guaranteed Evasion (CGE) algorithm.
"""

# noinspection PyPep8
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion exp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion exp/__main__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_validation.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down

0 comments on commit 2e11833

Please sign in to comment.