Skip to content

Zanku-Dev-Playground/Car-Learning-ML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LogVoyager - Self-Driving Car Evolution

A simple educational project demonstrating machine learning basics through neuroevolution. Watch cars learn to navigate a curved track using genetic algorithms and neural networks!

📚 Educational Purpose

This project was created for educational purposes to learn the fundamentals of machine learning. Through building this simulation, I learned:

  • Neural Networks: How simple feedforward networks process inputs and produce outputs
  • Genetic Algorithms: How evolution can train AI agents through selection, mutation, and reproduction
  • Fitness Functions: How to measure and compare performance
  • Sensor Systems: How agents can perceive their environment through ray casting
  • Evolutionary Computation: How populations improve over generations through natural selection

🚗 What It Does

The simulation features:

  • Population of 100 cars with neural network "brains"
  • 5 sensor rays that detect distance to track walls
  • Evolutionary learning where cars with better fitness pass their traits to the next generation
  • Curved track with turns and varying radius
  • Real-time visualization of cars learning to navigate

🎮 How to Run

python main.py

🎛️ Controls

  • Speed Button (green button on canvas): Click to increase car speed
  • Watch the Generation counter and Fitness scores improve over time

🔬 Key Concepts Learned

Neural Networks

  • Simple feedforward network: 5 inputs (sensor distances) → 1 output (steering direction)
  • Activation functions (tanh) for output normalization
  • Weight and bias initialization

Evolution

  • Fitness Evaluation: Distance traveled from start
  • Selection: Best performing cars are kept
  • Elitism: Top performers pass unchanged to next generation
  • Mutation: Small random changes to create variation
  • Population Management: 100 cars per generation

Machine Learning Basics

  • How neural networks learn patterns from data
  • The importance of fitness functions in evolutionary algorithms
  • The role of mutation rate in exploration vs exploitation
  • How generations improve through natural selection

📊 Technical Details

  • Language: Python 3.x
  • Libraries: tkinter (GUI), math, random, copy
  • Neural Network: Simple feedforward (no hidden layers)
  • Evolution: Genetic algorithm with elitism and mutation
  • Sensors: 5 ray-casting sensors at different angles

🎓 Learning Outcomes

This project helped me understand:

  1. How AI agents can learn through trial and error
  2. The basics of evolutionary computation
  3. How neural networks process information
  4. The relationship between inputs, weights, and outputs
  5. How fitness functions guide learning

📝 Note

This is a beginner-friendly educational project built from scratch to understand machine learning fundamentals. The implementation is intentionally simple to focus on core concepts rather than performance optimization.


Built for learning, built for fun! 🚗✨

About

Machine Learning basic project

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages