Skip to content

DarkPimbaa/genetic-neural-network

Repository files navigation

Genetic Neural Network

A neural network trained via genetic algorithm, implemented from scratch in JavaScript with no ML frameworks.

How It Works

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.

Training Pipeline

  1. Initialize - Create 10,000 individuals with random neural network weights
  2. Evaluate - Each individual processes the dataset and makes decisions
  3. Select - Rank individuals by fitness (cumulative performance)
  4. Mutate - Best individuals survive; weights are randomly perturbed
  5. Repeat - Evolution continues for configurable number of generations

Features

  • 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

Tech Stack

JavaScript (ES Modules), Node.js

Usage

node index.mjs

Configuration

Key parameters in index.mjs:

  • Population size
  • Number of generations
  • Network layer sizes
  • Mutation rate and range

License

MIT

About

Neural network trained via genetic algorithm, implemented from scratch in JavaScript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors