Overview
The experiment system provides a structured way to run, track, and version training experiments. Each experiment automatically logs hyperparameters, metadata, metrics, and checkpoints.Quick Start
Run a predefined experiment:Predefined Experiment Configs
The framework includes several predefined experiments inconfig.py:39-83:
baseline
Fast synthetic data experiment for testing:real_fashion_mnist
Full training on Fashion-MNIST dataset:synthetic_baseline
Synthetic experiment without auto-download:Custom Experiment Configs
Create a custom JSON configuration file:Configuration Parameters
Required Parameters
layer_sizes- List of layer dimensions (e.g.,[784, 64, 10])activations- Activation function for each layer (e.g.,["relu", "softmax"])
Training Parameters
epochs- Number of training epochs (default:3)alpha- Learning rate (default:0.1)batch_size- Mini-batch size (default:32)seed- Random seed for reproducibility (default:42)val_ratio- Validation split ratio (default:0.1)
Dataset Parameters
synthetic_mode- Use synthetic data instead of real dataset (default:False)synthetic_samples- Number of synthetic samples to generate (default:512)dataset_path- Path to dataset CSV filedataset_version- Dataset version identifierdataset_min_rows- Minimum expected rows for validation (default:100)dataset_auto_prepare- Auto-download dataset if missing (default:False)dataset_sha256- Expected SHA256 hash for integrity checking (optional)
Advanced Parameters
precision- Training precision:"float32","float16", or"int8"(default:"float32")hardware_constraint_mode- Hardware simulation mode (default:"off")
Experiment Tracking
Each experiment run automatically:- Creates a unique experiment ID from the config name
- Versions each run incrementally (v1, v2, v3, …)
- Logs all hyperparameters (epochs, alpha, batch_size, etc.)
- Records metadata (precision, model size, dataset version, SHA256 hash)
- Tracks metrics per epoch (loss, accuracy, val_loss)
- Saves checkpoints with versioned filenames
Output Files
After running an experiment:Experiment History Format
The history JSON file (experiments/logs/{experiment_id}.json) contains:
Implementation Details
The experiment workflow is implemented intrain.py:67-135:
- Resolve config - Load from
EXPERIMENT_CONFIGSor JSON file - Set global seed - Ensure reproducibility
- Create model - Initialize with precision config
- Load/generate data - Use synthetic or real dataset
- Train/val split - Split data with configurable ratio
- Start experiment - Create experiment record with metadata
- Train model - Run
model.fit()with early stopping support - Log metrics - Record training history
- Save checkpoint - Store model weights with version
Example Output
Related
- Dataset Configuration - Dataset preparation and validation
- Checkpointing - Save and load model weights
- Reproducibility - Seed management and deterministic training