Skip to content
Snippets Groups Projects
README.md 3.46 KiB
Newer Older
pat-alt's avatar
pat-alt committed
# ECCCo
pat-alt's avatar
pat-alt committed

pat-alt's avatar
ss  
pat-alt committed
![](www/poc_gradient_fields.png)
Pat Alt's avatar
Pat Alt committed

*Energy-Constrained Counterfactual Explanations.*

This work is currently undergoing peer review. This README is therefore only meant to provide reviewers access to the code base. The code base will be made public after the review process.

## Inspecting the Package Code

This code base is structured as a Julia package. The package code is located in the `src/` folder.

## Inspecting the Results

All results have been carefully reported either in the paper itself or in the supplementary material. In addition, we have released our results as binary files. These will be made publicly available after the review process. 

## Reproducing the Results

pat-alt's avatar
pat-alt committed
To reproduce the results, you need to install the package, which will automatically install all dependencies. Since the package is not publicly registered you will need to install it from source. To do so, start `Julia` from within this folder by executing `julia --project` from the command line and then enter `Pkg` mode by typing `]`. Then execute the following commands:

```julia
(ECCCo) pkg> resolve
(ECCCo) pkg> instantiate
```
Pat Alt's avatar
Pat Alt committed

pat-alt's avatar
pat-alt committed
Next, you may need to activate, resolve and instantiate the environment in `experiments`:
Pat Alt's avatar
Pat Alt committed

pat-alt's avatar
pat-alt committed
```julia
(ECCCo) pkg> activate experiments/
  Activating project at `~/code/ECCCo.jl/experiments`
(experiments) pkg> resolve
(experiments) pkg> instantiate
```
Pat Alt's avatar
Pat Alt committed

pat-alt's avatar
pat-alt committed
After that is done, you can exit Julia and proceed below.
pat-alt's avatar
pat-alt committed
### Sequential
Pat Alt's avatar
Pat Alt committed

pat-alt's avatar
pat-alt committed
The `experiments/` folder contains separate Julia scripts for each dataset and a [run_experiments.jl](experiments/run_experiments.jl) that calls the individual scripts. You can either run these scripts inside a Julia session or just use the command line to execute them as described in the following.
Pat Alt's avatar
Pat Alt committed

To run the experiment for a single dataset, (e.g. `linearly_separable`) simply run the following command:

```shell
Pat Alt's avatar
Pat Alt committed
julia --project=experiments/ experiments/run_experiments.jl -- data=linearly_separable
Pat Alt's avatar
Pat Alt committed
```

We use the following identifiers:

- `linearly_separable` (*Linearly Separable* data)
- `moons` (*Moons* data)
- `circles` (*Circles* data)
pat-alt's avatar
pat-alt committed
- `california_housing` (*California Housing* data)
- `gmsc` (*GMSC* data)
- `german_credit` (*German Credit* data)
Pat Alt's avatar
Pat Alt committed
- `mnist` (*MNIST* data)
Pat Alt's avatar
uh  
Pat Alt committed
- `fmnist` (*Fashion MNIST* data)
Pat Alt's avatar
Pat Alt committed

To run experiments for multiple datasets at once simply separate them with a comma `,`

```shell
Pat Alt's avatar
Pat Alt committed
julia --project=experiments/ experiments/run_experiments.jl -- data=linearly_separable,moons,circles
pat-alt's avatar
pat-alt committed
To run all experiments at once you can instead run

```shell
Pat Alt's avatar
Pat Alt committed
julia --project=experiments/ experiments/run_experiments.jl -- run-all
pat-alt's avatar
pat-alt committed
```
Pat Alt's avatar
Pat Alt committed

pat-alt's avatar
pat-alt committed
Pre-trained versions of all of our black-box models have been archived as `Pkg` [artifacts](https://pkgdocs.julialang.org/v1/artifacts/) and are used by default. Should you wish to retrain the models as well, simply use the `retrain` flag as follows:
Pat Alt's avatar
Pat Alt committed

```shell
pat-alt's avatar
pat-alt committed
julia --project=experiments experiments/run_experiments.jl -- retrain data=linearly_separable
Pat Alt's avatar
Pat Alt committed
```

pat-alt's avatar
pat-alt committed
### Multi-threading
Pat Alt's avatar
Pat Alt committed

pat-alt's avatar
pat-alt committed
To use multi-threading, proceed as follows:

Pat Alt's avatar
Pat Alt committed
```shell
julia --threads 16 --project=experiments experiments/run_experiments.jl -- data=linearly_separable threaded
```

pat-alt's avatar
pat-alt committed
### Multi-Processing
Pat Alt's avatar
Pat Alt committed

pat-alt's avatar
pat-alt committed
To use multi-processing, proceed as follows:

Pat Alt's avatar
Pat Alt committed
```shell
mpiexecjl --project=experiments -n 4 julia experiments/run_experiments.jl -- data=linearly_separable mpi
```

Multi-processing and multi-threading can be combined:

```shell
Pat Alt's avatar
Pat Alt committed
mpiexecjl --project=experiments -n 4 julia experiments/run_experiments.jl -- data=linearly_separable threaded mpi