packages = ["bokeh", "pandas", "numpy", "networkx", "diagrams", "scikit-learn", "pillow", "matplotlib", "plotly"] [[fetch]] files = ["diagrams_base.py"] from = "../../python/diagrams/" [[fetch]] files = ["pyscript_manager.py", "data.py"] to_folder = "lib" from = "../../python/lib/" [[fetch]] files = ["bokeh_utils.py"] from = "../../python/bokeh/" [[fetch]] files = ["matplotlib_utils.py", "plotly_utils.py"] from = "../../python/matplotlib/" [[fetch]] files = ["agent.py", "trainer.py", "utils.py", "metrics_chart.py", "crossover.py", "__init__.py"] to_folder = "ml/neuro" from = "../../python/ml/neuro/" [[fetch]] files = ["trainer.py"] to_folder = "ml/grokking" from = "../../python/ml/grokking/"

Loading...

Click a button to begin

Original behavior - mutate top performers

Mario AI - Neuroevolution

đŸ§Ŧ What is Neuroevolution?

Neuroevolution trains neural networks using genetic algorithms instead of traditional backpropagation. Networks "evolve" through mutation and selection - just like biological evolution!

  1. Create random neural network weights
  2. Evaluate by playing the game (fitness = distance traveled)
  3. Select the best performers
  4. Mutate/Breed to create new generation
  5. Repeat until it beats the level!

🔄 Training Modes

  • Simple: Mutation only - copy and mutate top performers
  • SBX Crossover: Two-parent breeding using Simulated Binary Crossover. Creates offspring near parents, good for fine-tuning.
  • Uniform Crossover: Random gene mixing from two parents. More exploration, can combine diverse strategies.
  • Optimize: Start from pre-trained reference weights and continue training. Good for pushing past Level 1-1!

đŸ—ī¸ Network Architecture

Input: 80 values (7×10 tile vision + 10 row encoding)
Hidden: 9 neurons with ReLU activation
Output: 6 buttons (LEFT, RIGHT, A, B + filtered UP/DOWN)

⚡ Training Pipeline

Foreground: Shows best performer playing
Background: Runs population evaluation (headless, fast)
Python: Handles neural network evolution via PyScript

🐍 Python Console