# Scout
**Production-Ready Hyperparameter Optimization for Elixir**
[](https://github.com/jmanhype/scout/actions/workflows/ci.yml)
[](https://codecov.io/gh/jmanhype/scout)
[](https://hex.pm/packages/scout)
[](https://hexdocs.pm/scout)
[](https://opensource.org/licenses/MIT)
[](https://hub.docker.com/r/scout/scout)
Scout is a production-ready hyperparameter optimization framework with high feature parity with Optuna, leveraging Elixir's BEAM platform for superior fault tolerance, real-time dashboards, and native distributed computing.
## Quick Start
**Try it now - no database required!**
```bash
git clone https://github.com/your-org/scout
cd scout && mix deps.get
cd apps/scout_core && mix run ../../quick_start.exs
```
See [QUICK_START.md](QUICK_START.md) for a complete 30-second tutorial.
**From code:**
```elixir
# Start Scout (uses ETS - no database needed)
Application.ensure_all_started(:scout_core)
# Optimize like Optuna
result = Scout.Easy.optimize(
fn params -> train_model(params) end,
%{learning_rate: {:log_uniform, 1e-5, 1e-1}, n_layers: {:int, 2, 8}},
n_trials: 100
)
IO.puts("Best: #{result.best_value} with #{inspect(result.best_params)}")
```
## Why Scout?
### Complete Feature Parity with Optuna
**High feature parity** - All major Optuna features implemented and validated on standard benchmarks:
- **23 Samplers**: TPE (all variants), CMA-ES, NSGA-II, QMC, GP-BO, Random, Grid
- **7 Pruners**: Median, Percentile, Patient, Threshold, Wilcoxon, SuccessiveHalving, Hyperband
- **Multi-objective**: NSGA-II + MOTPE with Pareto dominance
- **Advanced TPE**: Multivariate, conditional, prior-weighted, warm-starting
- **ML Integration**: Native Axon neural network support
- **Simple API**: `Scout.Easy.optimize()` matches Optuna exactly
### Real-Time Dashboard
- Phoenix LiveView dashboard with live progress tracking
- Interactive visualizations: Parameter correlation, convergence plots
- Study management: Pause/resume/cancel operations
- Multi-study monitoring: Track multiple optimizations simultaneously
### BEAM Platform Advantages
- **Fault tolerance**: Trials run in isolated processes — crashes are contained and supervisors restart work without killing the study
- **Hot code reloading**: Update samplers during long optimizations
- **Native distribution**: Multi-node optimization out of the box
- **Actor model**: No shared mutable state by default, dramatically reducing race-condition risk
- **Supervision trees**: Automatic recovery from failures
### Production-Ready Infrastructure
- **Docker**: Single-command deployment with docker-compose
- **Kubernetes**: Complete manifests with auto-scaling, persistence, monitoring
- **Observability**: Prometheus metrics + Grafana dashboards
- **Security**: HTTPS, secrets management, non-root containers
- **High Availability**: Multi-replica deployment with load balancing
## Performance Benchmarks
Scout's sampler implementations validated on standard optimization benchmarks with **90%+ test coverage**:
### Scout vs Optuna: Side-by-Side Comparison
RandomSampler on standard test functions (100 trials, 10 runs, mean ± std):
| Function | Scout | Optuna 3.x | Difference |
|----------|-------|------------|------------|
| **Sphere (5D)** | 8.21 ± 2.28 | 8.39 ± 3.37 | -2.1% |
| **Rosenbrock (2D)** | 0.29 ± 0.34 | 0.84 ± 0.57 | +190% (Scout better) |
| **Rastrigin (5D)** | 32.55 ± 9.07 | 34.13 ± 8.59 | -4.6% |
| **Ackley (2D)** | 2.36 ± 1.21 | 2.66 ± 0.84 | -11.3% |
**Result**: Scout's RandomSampler shows statistically equivalent performance to Optuna on 3/4 benchmarks, with better performance on Rosenbrock's narrow valley function.
**Methodology**: Identical conditions (same bounds, same trial count, same random sampling algorithm). Run `python3 benchmark_optuna_comparison.py` to reproduce.
### v0.3.0 Comprehensive Benchmarks
- **Sampler Comparison**: TPE, Random, Grid, Bandit on 2D/5D problems → [Results](BENCHMARK_RESULTS.md#sampler-comparison)
- **Pruner Effectiveness**: Median, Percentile, Hyperband, SuccessiveHalving validation → [Results](BENCHMARK_RESULTS.md#pruner-effectiveness)
- **Scaling & Parallelism**: Dimension scaling (2D→20D), parallel speedup (1-4 workers) → [Results](BENCHMARK_RESULTS.md#scaling-and-parallelism)
**See [BENCHMARK_RESULTS.md](BENCHMARK_RESULTS.md)** for complete analysis including:
- Statistical methodology and mathematical function definitions
- Sampler comparison showing TPE advantages on multimodal functions
- Pruner configuration guidance and expected savings (30-70% compute time)
- Parallel execution efficiency (60-90% with 2-4 workers)
- Reproduction instructions for all benchmarks
## Installation
```elixir
# mix.exs
defp deps do
[
{:scout, "~> 0.3"},
# Auto-included: Phoenix LiveView, Oban, Ecto
]
end
```
```bash
# Setup
mix deps.get
cp config.sample.exs config/config.exs # Configure database
mix ecto.create && mix ecto.migrate
# Run with dashboard
mix scout.server
# Dashboard: http://localhost:4050
```
## Docker Deployment
```bash
# Quick start
git clone <scout-repo>
cd scout
docker-compose up -d
# Access services
# Scout Dashboard: http://localhost:4050
# Grafana Monitoring: http://localhost:3000
# Prometheus Metrics: http://localhost:9090
```
## Kubernetes Deployment
```bash
# Production deployment
kubectl apply -f k8s/postgres.yaml # Database
kubectl apply -f k8s/secrets.yaml # Configuration
kubectl apply -f k8s/deployment.yaml # 3-replica Scout app
# Auto-scaling, persistence, monitoring included
```
## Real ML Example
```elixir
# Neural network hyperparameter optimization
result = Scout.Easy.optimize(
fn params, report_fn ->
model = build_model(
layers: params.n_layers,
neurons: params.neurons,
dropout: params.dropout
)
# Train with early stopping
for epoch <- 1..20 do
loss = train_epoch(model, params.learning_rate, params.batch_size)
case report_fn.(loss, epoch) do
:continue -> :ok
:prune -> throw(:early_stop) # Hyperband pruning
end
end
validate_model(model)
end,
%{
# Architecture
n_layers: {:int, 2, 8},
neurons: {:int, 32, 512},
dropout: {:uniform, 0.1, 0.5},
# Training
learning_rate: {:log_uniform, 1e-5, 1e-1},
batch_size: {:choice, [16, 32, 64, 128]},
optimizer: {:choice, ["adam", "sgd", "rmsprop"]}
},
n_trials: 100,
sampler: :tpe, # Tree-structured Parzen Estimator
pruner: :hyperband, # Aggressive early stopping
parallelism: 4, # 4 concurrent trials
dashboard: true # Real-time monitoring
)
# Live dashboard shows progress at http://localhost:4050
IO.puts("Best accuracy: #{result.best_value}")
IO.puts("Best params: #{inspect(result.best_params)}")
```
## Distributed Optimization
```elixir
# Multi-node setup
Node.connect(:"worker@node1")
Node.connect(:"worker@node2")
result = Scout.Easy.optimize(
expensive_ml_objective,
complex_search_space,
n_trials: 1000,
parallelism: 20, # Distributed across cluster
executor: :oban, # Persistent job queue
dashboard: true # Monitor from any node
)
```
## Migration from Optuna
Scout provides drop-in replacement simplicity:
**Optuna (Python)**
```python
import optuna
study = optuna.create_study()
study.optimize(objective, n_trials=100)
print(study.best_params)
```
**Scout (Elixir)**
```elixir
result = Scout.Easy.optimize(objective, search_space, n_trials: 100)
IO.puts(inspect(result.best_params))
```
### Migration Benefits
- Same algorithms (TPE, Hyperband, NSGA-II)
- Better visualization (real-time vs static)
- Superior fault tolerance (BEAM supervision)
- Native distribution (BEAM clustering + Oban)
- Production infrastructure (Docker + K8s ready)
## Documentation
- [Quick Start](examples/quick_start.exs) - 3-line examples
- [Benchmark Results](BENCHMARK_RESULTS.md) - Comprehensive benchmarks: Optuna parity, sampler comparison, pruner effectiveness, scaling
- [Deployment Guide](DEPLOYMENT.md) - Docker + Kubernetes setup
- [API Reference](https://hexdocs.pm/scout) - Complete documentation
- [Examples](examples/) - Real ML optimization examples
## Architecture
```
Scout Production Stack
├── Scout.Easy API # Optuna-compatible interface
├── Phoenix Dashboard # Real-time monitoring
├── Advanced Samplers # TPE, CMA-ES, NSGA-II, QMC
├── Intelligent Pruners # Hyperband, Successive Halving
├── Oban Execution # Distributed job processing
├── Ecto Persistence # PostgreSQL storage
├── Docker Images # Production containers
├── Kubernetes Manifests # Auto-scaling deployment
└── Monitoring Stack # Prometheus + Grafana
```
## What's New in v0.3
- **90%+ Test Coverage**: Quality-assured public API with comprehensive test suite
- **Comprehensive Benchmarks**: Sampler comparison, pruner effectiveness, scaling validation
- **CI Quality Gates**: Automated coverage enforcement and benchmark smoke tests
- **Production Infrastructure**: Docker + K8s + monitoring
- **High Optuna Parity**: All major samplers and pruners validated
- **Real-time Dashboard**: Phoenix LiveView monitoring
- **Distributed Execution**: Oban job queue integration
- **Security**: HTTPS, secrets management, non-root containers
- **Auto-scaling**: Kubernetes horizontal pod autoscaling
- **Performance Validation**: Complete benchmark suite with reproduction instructions
## Production Features
- **High Availability**: Multi-replica deployment with health checks
- **Persistent Storage**: PostgreSQL with backup support
- **Monitoring**: Prometheus metrics + Grafana dashboards
- **Security**: HTTPS/TLS, secret management, firewall configuration
- **Scalability**: Horizontal scaling with resource limits
- **Fault Tolerance**: BEAM supervision trees + retry logic
- **Study Management**: Pause/resume/cancel operations via dashboard
## Contributing
- **Issues**: [GitHub Issues](https://github.com/scout/scout/issues)
- **Features**: Propose new samplers or dashboard features
- **Docs**: Improve examples and deployment guides
- **Testing**: Add benchmarks and production validation
## License
MIT License - see [LICENSE](LICENSE) for details.
## Acknowledgments
- Optuna team for algorithmic foundations
- Elixir/Phoenix community for the incredible platform
- BEAM ecosystem for robust fault tolerance
---
**Scout: Production-ready hyperparameter optimization that scales with your ambitions.**
[Quick Start](examples/quick_start.exs) | [Benchmarks](BENCHMARK_RESULTS.md) | [Deploy](DEPLOYMENT.md) | [Dashboard](http://localhost:4050) | [Examples](examples/)