A neural network trained via genetic algorithm, implemented from scratch in JavaScript with no ML frameworks.
The system evolves a population of 10,000 neural network individuals over thousands of generations. Each individual's fitness is evaluated by simulating decisions on historical data. The best-performing individuals survive and their weights are mutated to create the next generation.
- Initialize - Create 10,000 individuals with random neural network weights
- Evaluate - Each individual processes the dataset and makes decisions
- Select - Rank individuals by fitness (cumulative performance)
- Mutate - Best individuals survive; weights are randomly perturbed
- Repeat - Evolution continues for configurable number of generations
- Neural network forward pass implemented from scratch
- Genetic algorithm with selection, crossover, and mutation
- Population-based training (10,000 individuals per generation)
- Configurable network architecture and training parameters
- Binary weight serialization for saving/loading trained models
- No external ML dependencies
JavaScript (ES Modules), Node.js
node index.mjsKey parameters in index.mjs:
- Population size
- Number of generations
- Network layer sizes
- Mutation rate and range
MIT