You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+57-9Lines changed: 57 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,8 +82,39 @@ This is a [summary](./report/CSI5186_AI_Testing_Project_Report___Fernando__Kelvi
82
82
```
83
83
84
84
## Execution Guide
85
-
### Data Preparation
86
-
1. Run `data_download.py` to firstly download the datasets needed.
85
+
86
+
### Complete Pipeline (Recommended)
87
+
Run the complete pipeline from data preparation through experiments to final training:
88
+
89
+
```bash
90
+
# Run all models with all optimizers
91
+
python main.py
92
+
93
+
# Run specific model with all optimizers
94
+
python main.py --model dt
95
+
96
+
# Run specific model with specific optimizer
97
+
python main.py --model cnn --optimizer rs
98
+
99
+
# Force re-download and re-process datasets
100
+
python main.py --force
101
+
```
102
+
103
+
**Available arguments:**
104
+
-`--model`: Model to run - `["dt", "knn", "cnn"]`. If omitted, runs all models.
105
+
-`--optimizer`: Optimizer to use - `["rs", "ga-standard", "ga-memetic", "pso"]`. If omitted, runs all optimizers for each model.
106
+
-`--force`: Force re-download and re-processing of datasets (default: False).
107
+
108
+
**Pipeline stages:**
109
+
1.**Data Download**: Automatically downloads CIFAR-10 dataset (if not present or with `--force`)
110
+
2.**Data Processing**: Processes and prepares datasets (if not present or with `--force`)
111
+
3.**Hyperparameter Search**: Runs experiments for specified model(s) and optimizer(s) combinations
112
+
4.**Final Training**: Trains models with best-found hyperparameters on full dataset and evaluates on test set
113
+
114
+
### Data Preparation (Manual)
115
+
If you prefer to run data preparation separately:
116
+
117
+
1. Run `data_download.py` to download the datasets needed.
87
118
* Note: Data are stored into the `.cache\` folder which is gitignored.
88
119
* Note: Should you rerun the script again, and the folder already exists with contents, please run the script with argument `--force` to enable a smooth overwriting behavior.
89
120
2. Run `data_process.py` to process the images in the datasets.
@@ -137,24 +168,41 @@ python hparam_search.py
137
168
* It passes parameters directly to model creation/training; and so, it'll be less flexible for advanced training configs (e.g., custom epochs, patience).
138
169
* It is intended for quick experiments, visualizations, and debugging with a single optimizer.
139
170
140
-
### Run a Full Experiment
141
-
* You can run a full hyperparameter search based on this script:
171
+
### Run a Full Experiment (Advanced)
172
+
If you want more control over the experiment parameters, you can run experiments directly using this script:
-`--model`: Model Choices - `["dt", "knn", "cnn"]`. **Mandatory** argument!!!
178
+
-`--optimizer`: Optimizer to use - `["rs", "ga-standard", "ga-memetic", "pso"]`. If omitted, runs all optimizers.
147
179
-`--runs`: Number of independent runs - default 1.
148
-
-`--trials`: Number of Evaluations - default 5.
149
-
-`--evaluations`: Number of fitness evaluations per run - default 50
180
+
-`--evaluations`: Number of fitness evaluations per run - default 50.
150
181
-`--seed`: Base seed for randomization - default 42.
151
182
-`--n-jobs`: Number of parallel workers - default 1 for a sequential run. Use -1 for all CPUs.
152
183
153
184
* It is designed for systematic, reproducible experiments across all kinds of optimizers.
154
185
* All optimizers are supported and selectable via CLI.
155
186
* It saves results, convergence traces, and summaries to disk for later analysis (but not on TensorBoard).
156
187
* For CNN, it uses a TrainingConfig object for fine-grained control (learning rate, weight decay, optimizer, batch size, patience); and disables early stopping for CNN by default for fair comparison.
157
-
* Given its flexibility and robustness, it is intended for benchmarking, comparison, and research—especially when comparing optimizer performanc.
188
+
* Given its flexibility and robustness, it is intended for benchmarking, comparison, and research—especially when comparing optimizer performance.
189
+
190
+
### Run Final Training (Advanced)
191
+
After running experiments, you can run final training separately:
192
+
```bash
193
+
python scripts/run_final_training.py
194
+
```
195
+
**Available arguments:**
196
+
-`--seed`: Seed for final training runs - default 42.
197
+
-`--experiments`: Optional list of experiment names (e.g., `dt-rs`, `cnn-ga-standard`) to include. If omitted, trains all experiments found in `.cache/experiment/`.
198
+
-`--max-parallel-cnn`: Maximum parallel CNN trainings - default 1.
199
+
-`--max-parallel-classic`: Maximum parallel DT/KNN trainings - default 1.
200
+
201
+
This script:
202
+
- Loads best hyperparameters from each experiment's best run
203
+
- Trains models on the full training set
204
+
- Evaluates on the held-out test set
205
+
- Saves trained models and results to `.cache/final_training/`
158
206
159
207
### Analyze Results
160
208
Upon completion of an execution from the `run_experiment.py` script, you will likely get some folders under `.cache/experiment` folder. You can visualize plots for analysis based on this script:
0 commit comments