Skip to main content

neat (wip)

Explorations into NEAT and some of its derivative research

install

In project root, run

$ sh install.sh

usage

Distill / behavior-clone an evolved champion NEAT network into any barebones PyTorch MLP:

import torch
import torch.nn as nn
import gymnasium as gym

from neat import NEAT, behavior_clone

# 1. train NEAT on an environment

env = gym.make('CartPole-v1')
pop = NEAT(4, 16, 2, pop_size = 64)

# ... evolve population ...

# 2. extract champion network

champion = pop.champion

# 3. define any barebones PyTorch MLP

mlp = nn.Sequential(
    nn.Linear(4, 32),
    nn.Tanh(),
    nn.Linear(32, 2)
)

# 4. behavior clone and save .pt to project root

behavior_clone(
    env,
    champion,
    mlp,
    save_path = 'mlp-cartpole.pt'  # saved directly to project root
)

quick test

$ uv run train_lunar.py

To run the end-to-end CartPole evolution, behavior cloning, and validation:

$ uv run train_bc_cartpole.py

citations

@article{Stanley2011CompetitiveCT,
    title   = {Competitive Coevolution through Evolutionary Complexification},
    author  = {Kenneth O. Stanley and Risto Miikkulainen},
    journal = {ArXiv},
    year    = {2011},
    volume  = {abs/1107.0037},
    url     = {https://api.semanticscholar.org/CorpusID:11881625}
}
@inproceedings{4665912,
    author  = {Miguel, Cesar Gomes and Silva, Carolina Feher da and Netto, Marcio Lobo},
    booktitle = {2008 10th Brazilian Symposium on Neural Networks},
    title   = {Structural and Parametric Evolution of Continuous-Time Recurrent Neural Networks},
    year    = {2008},
    doi     = {10.1109/SBRN.2008.12}
}
@article{Khamesian2021HybridSN,
    title   = {Hybrid self-attention NEAT: a novel evolutionary self-attention approach to improve the NEAT algorithm in high dimensional inputs},
    author  = {Saman Khamesian and Hamed Malek},
    journal = {Evolving Systems},
    year    = {2021},
    pages   = {1-15},
    url     = {https://api.semanticscholar.org/CorpusID:244920723}
}
@article{Hornby2006AutomatedAD,
    title   = {Automated Antenna Design with Evolutionary Algorithms},
    author  = {Gregory Hornby and Al Globus and Derek S. Linden and Jason D. Lohn},
    journal = {Space},
    year    = {2006},
    url     = {https://api.semanticscholar.org/CorpusID:8290212}
}
@inproceedings{schrum:gecco14,
    title   = {Evolving Multimodal Behavior With Modular Neural Networks in Ms. Pac-Man},
    author  = {Jacob Schrum and Risto Miikkulainen},
    booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference (GECCO 2014)},
    month   = {July},
    address = {Vancouver, BC, Canada},
    pages   = {325--332},
    note    = {Best Paper: Digital Entertainment and Arts},
    url     = {http://www.cs.utexas.edu/users/ai-lab?schrum:gecco2014},
    year    = {2014}
@article{stanley:ec02,
    title   = {Evolving Neural Networks Through Augmenting Topologies},
    author  = {Kenneth O. Stanley and Risto Miikkulainen},
    volume  = {10},
    journal = {Evolutionary Computation},
    number  = {2},
    pages   = {99-127},
    url     = "http://nn.cs.utexas.edu/?stanley:ec02",
    year    = {2002}
}
@misc{doerr2017fastgeneticalgorithms,
    title   = {Fast Genetic Algorithms},
    author  = {Benjamin Doerr and Huu Phuoc Le and Régis Makhmara and Ta Duy Nguyen},
    year    = {2017},
    eprint  = {1703.03334},
    archivePrefix = {arXiv},
    primaryClass = {cs.NE},
    url     = {https://arxiv.org/abs/1703.03334},
}
@misc{legg2004tournamentversusfitnessuniform,
    title   = {Tournament versus Fitness Uniform Selection},
    author  = {Shane Legg and Marcus Hutter and Akshat Kumar},
    year    = {2004},
    eprint  = {cs/0403038},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url     = {https://arxiv.org/abs/cs/0403038},
}
@article{hiraga2024improving,
    title   = {Improving the performance of mutation-based evolving artificial neural networks with self-adaptive mutations},
    author  = {Hiraga, Motoaki and Komura, Masahiro and Miyamoto, Akiharu and Morimoto, Daichi and Ohkura, Kazuhiro},
    journal = {PLOS ONE},
    volume  = {19},
    number  = {7},
    pages   = {e0307084},
    year    = {2024},
    publisher = {Public Library of Science},
    doi     = {10.1371/journal.pone.0307084},
    url     = {https://doi.org/10.1371/journal.pone.0307084}
}
@inproceedings{tackett1994unique,
    title     = {The unique implications of brood selection for genetic programming},
    author    = {Tackett, Walter Alden and Carmi, Aviram},
    booktitle = {Proceedings of the First IEEE Conference on Evolutionary Computation. IEEE World Congress on Computational Intelligence},
    pages     = {160--165},
    year      = {1994},
    organization = {IEEE},
    doi       = {10.1109/ICEC.1994.350030}
}
@article{clune2013evolutionary,
    title     = {The evolutionary origins of modularity},
    author    = {Clune, Jeff and Mouret, Jean-Baptiste and Lipson, Hod},
    journal   = {Proceedings of the Royal Society B: Biological Sciences},
    volume    = {280},
    number    = {1755},
    pages     = {20122863},
    year      = {2013},
    publisher = {The Royal Society},
    doi       = {10.1098/rspb.2012.2863}
}

Metadata

Release files for x-neat 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for x-neat 0.0.9
File Size Uploaded
x_neat-0.0.9.tar.gz 30.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for x-neat 0.0.9
File Interpreter ABI Platform
x_neat-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 56.6 kB

Release files / x_neat-0.0.9.tar.gz

Download URL x_neat-0.0.9.tar.gz
Size 30.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9a72d8572a6ead4b632689e1583e000de124323a44e7e70b0711b1114dba345a
BLAKE2b-256 checksum
How to use checksums
fcaf2f89564fe47e8e62424dd5b1045ac4d241910b475b6e3a5ecd1723259fa4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Release files / x_neat-0.0.9-py3-none-any.whl

Download URL x_neat-0.0.9-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2db67fc5e1a20157557ba838b9b79c4003da09ff3f605bdb5fe57dd56ed86ddd
BLAKE2b-256 checksum
How to use checksums
5e29f88bd79cf2993376d35c933e9ead0cb53a9ca62301931ec7f674f4697ab0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page