How bumsu-kim/cars works
Project type and purpose
• This is a research codebase implementing “Curvature-Aware Derivative-Free Optimization” (CARS) and running three experiments:
– A minimal MATLAB demo (CARS_minimal)
– A benchmark suite on More-Garbow-Hillstrom test functions (CARS_MoreGarbowHillstrom)
File structure
• Top-level folders:
– CARS_minimal (MATLAB)
– CARS_MoreGarbowHillstrom (MATLAB)
– CARS_MNIST (Python + notebooks)
• Shared root files: LICENSE, top-level README.md
• Each experiment folder contains its own README and driver scripts that call:
– Core algorithm modules (Directional_Newton.m, GH_Deriv.m, etc.)
– Utilities (Param_Settings, PickRandDir, performance_profile, plot_res)
– Data (for MNIST: raw & processed files)
– Notebooks for interactive exploration
README for additional insights
• The root README states the three experiments and points to a refactored Python package.
• No monolithic server or UI—this is a library + batch‐style experiment suite.
Main components and their interactions
a. Core Library of Optimizers
– CARS algorithm implementations (e.g., CARS.m, AdaDGS.m, RealSPSA.m)
– Supporting derivatives and quadrature modules (GH_Deriv.m, GH_quad.m)
– Common utility functions (PickRandDir.m, Param_Settings.m)
b. Experiment Drivers
– CARS_minimal/SimpleDemo.m (calls core library)
– CARS_MoreGarbowHillstrom/more_run.m & more_test.m (benchmark scripts)
– CARS_MNIST/MNIST_Train.py, MNIST_Attack.py, AttackTools.py, DataLoaders.py
c. Data Layers
– MATLAB: no external data (built-in test functions)
– Python: MNIST/raw → processed (.pt files) → DataLoaders
d. Outputs
– MATLAB: performance_profile plots, .m result files
– Python: trained models (models/MNIST_weights.pth), attack results
e. External Dependencies
– MATLAB (no extra toolboxes beyond base)
– Python: PyTorch (assuming from file extensions .pth), numpy, torch.utils.data
Architectural patterns / design principles
• Modular core library with experiment‐specific driver scripts
• Separation of concerns:
– Algorithm implementations separate from data I/O and experiment orchestration
• Reusability: same algorithm modules used by both minimal demo and full benchmark
• Batch-style pipelines (no persistent services)
Essential elements
– Clear labels: e.g., “PickRandDir.m” vs. “Network.py”
– Note any loops or iterative calls (optimizer loops inside MNIST_Train)
| Core Algorithms | CARS_minimal Pipeline | CARS_MoreGH Pipeline | CARS_MNIST Pipeline |
| [CARS.m, GH_Deriv.m, …] → | SimpleDemo.m → CARS.m → performance_profile → plots
| → | more_run.m → core modules → performance_profile → plots
| → | MNIST_Train.py
| → | ↳ DataLoaders.py → MNIST/raw → MNIST/processed
| → | ↳ Network.py
| → | ↳ AttackTools.py → outputs/models/*.pth