Skip to content

Commit b09a9d8

Browse files
committed
Algorithm Rehaul
1 parent db33114 commit b09a9d8

11 files changed

Lines changed: 704 additions & 24 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
"""Run the confirmed adaptive-NEAT comparison against Adam and SGD."""
2+
3+
from __future__ import annotations
4+
5+
import json
6+
from pathlib import Path
7+
8+
from benchmarks.tasks.keras_mlp import (
9+
BenchmarkConfig,
10+
OptimizerSpec,
11+
run_optimizer_suite,
12+
)
13+
14+
15+
def main() -> None:
16+
specs = (
17+
OptimizerSpec("sgd_momentum", "sgd_momentum", {"learning_rate": 1e-2}),
18+
OptimizerSpec("adam", "adam", {"learning_rate": 1e-3}),
19+
OptimizerSpec(
20+
"neat_adaptive_best",
21+
"neat",
22+
{
23+
"learning_rate": 0.008,
24+
"alpha": 0.25,
25+
"beta": 0.9,
26+
"opponent_source": "previous_gradient",
27+
"nce_mode": "projection",
28+
"nce_clip_ratio": 1.0,
29+
"adaptive_correction": True,
30+
"adaptive_correction_decay": 0.9,
31+
"adaptive_correction_min_scale": 1.0,
32+
"adaptive_correction_max_scale": 2.5,
33+
"adaptive_preconditioning": True,
34+
"second_moment_beta": 0.999,
35+
"bias_correction": True,
36+
"precondition_nce": True,
37+
"correction_warmup_steps": 0,
38+
"conflict_threshold": 0.0,
39+
},
40+
),
41+
)
42+
result = run_optimizer_suite(
43+
specs,
44+
config=BenchmarkConfig(seeds=(7, 11, 19), epochs=20, batch_size=64),
45+
)
46+
output = Path("benchmarks/results/neat_adaptive_confirm_2026-04-05.json")
47+
output.write_text(json.dumps(result, indent=2))
48+
print(output)
49+
for row in result["summary"]:
50+
print(
51+
row["optimizer"],
52+
row["mean_test_accuracy"],
53+
row["mean_test_loss"],
54+
row["mean_seconds"],
55+
)
56+
57+
58+
if __name__ == "__main__":
59+
main()

0 commit comments

Comments
 (0)