# Scripts

This directory contains all scripts for the VeriCluX project, organized by execution environment and purpose.

## Directory Structure

```
scripts/
├── tools/                    # Python execution scripts
│   ├── train.py             # Train neural network models
│   ├── classify.py          # Classify samples using trained models
│   ├── generate_explanations.py  # Generate explanations for clusters or single samples
│   ├── inflate_explanations.py   # Inflate explanations with uncertainty bounds
│   ├── clean_data.py        # Clean and preprocess datasets
│   ├── compact_data.py      # Compress and compact data for efficient storage
│   ├── visualize_results.py # Create plots and visualizations of results
│   ├── evaluate_performance.py
│   ├── evaluate_explanations.py
│   └── evaluate_robustness.py
├── figures/                  # Figure generation scripts (Bash)
│   ├── generate_delta_robust_figures.sh    # All delta-robust figures
│   ├── generate_cluster_figures.sh         # All cluster figures
│   └── generate_all_figures.sh             # Master script
├── batch/                    # Batch execution scripts (SLURM, etc.)
│   ├── train_classic.sh     # Train models on classic datasets
│   ├── train_custom.sh      # Train models on custom datasets
│   ├── delta_robust/        # Delta-robust explanation experiments
│   │   ├── classic/         # Classic datasets (evaluation)
│   │   │   ├── generate_robust_explanations.sh
│   │   │   └── generate_inflated_explanations.sh
│   │   └── scalability/     # Custom datasets (scalability analysis)
│   │       ├── generate_robust_explanations.sh
│   │       └── generate_inflated_explanations.sh
│   └── cluster/             # Cluster explanation experiments
│       ├── classic/         # Classic datasets (evaluation)
│       │   ├── generate_individual_explanations.sh
│       │   └── generate_cluster_explanations.sh
│       └── scalability/     # Custom datasets (scalability analysis)
│           ├── generate_individual_explanations.sh
│           └── generate_cluster_explanations.sh
└── utils.py                 # Shared utilities
```

## Usage


### Figure Generation Scripts

```sh
# Generate specific figure sets
bash scripts/figures/generate_delta_robust_figures.sh
bash scripts/figures/generate_cluster_figures.sh

# Generate all figures
bash scripts/figures/generate_all_figures.sh
```

### Tools

Run each script with `--help` to see available options:

```sh
# Training and classification
python -m scripts.tools.train --help
python -m scripts.tools.classify --help

# Explanation generation
python -m scripts.tools.generate_explanations --help
python -m scripts.tools.inflate_explanations --help

# Data processing
python -m scripts.tools.clean_data --help
python -m scripts.tools.compact_data --help

# Visualization and analysis
python -m scripts.tools.visualize_results --help
python -m scripts.tools.evaluate_performance --help
python -m scripts.tools.evaluate_explanations --help
python -m scripts.tools.evaluate_robustness --help
```

### Batch Scripts

Submit to a cluster job scheduler (e.g., SLURM):

```sh
# Training
sbatch scripts/batch/train_classic.sh
sbatch scripts/batch/train_custom.sh

# Delta-robust explanations
sbatch scripts/batch/delta_robust/classic/generate_robust_explanations.sh
sbatch scripts/batch/delta_robust/scalability/generate_robust_explanations.sh

# Cluster explanations
sbatch scripts/batch/cluster/classic/generate_cluster_explanations.sh
sbatch scripts/batch/cluster/scalability/generate_cluster_explanations.sh
```

## Data Organization

The data directory follows a concept-driven structure:

```
data/
├── logs/                  # Raw log files (if present)
│   ├── delta_robust/      # Log files for delta-robust experiments
│   │   ├── classic/       # Classic datasets (evaluation)
│   │   └── scalability/   # Custom datasets (scalability analysis)
│   └── cluster/           # Log files for cluster experiments
│       ├── classic/       # Classic datasets (evaluation)
│       ├── scalability/   # Custom datasets (scalability analysis)
│       └── examples/      # Example datasets (MNIST)
└── explanations/          # Processed explanation data (CSV files)
    ├── delta_robust/      # Delta-robust explanation data
    │   ├── classic/       # Classic datasets (evaluation)
    │   └── scalability/   # Custom datasets (scalability analysis)
    └── cluster/           # Cluster explanation data
        ├── classic/       # Classic datasets (evaluation)
        ├── scalability/   # Custom datasets (scalability analysis)
        └── examples/      # Example data (MNIST)
```
