In this lab you will experiment with an evolutionary computation method called NEAT (Neuro Evolution of Augmenting Topologies) developed by Kenneth O. Stanley. NEAT operates on both the weights and the structure of the neural network, allowing connections and nodes to be added as potential mutations. We will be using a python package that implements NEAT.
You may work with a partner on this lab.
% python >>> from neat import *If you are not able to import the neat package, let me know, otherwise exit from python.
/usr/local/stow/cs81/lib/python2.6/site-packages/neat
In Lab 1 we used the back propagation algorithm to learn the weights of a fixed architecture neural neural network to solve XOR. In this lab we will use NEAT to evolve both the weights and the architecture of a neural network to solve XOR.
% python xor.pyThis will produce a number of messages detailing the progress of the evolutionary process. For each generation you will see the average fitness, best fitness, number of species, and information about each species. At the end, will be a summary of the architecture of the best performing individual found, and a demonstration of how it perfroms on the four patterns.
The NEAT paper we discussed this week involved a very time consuming fitness test intended to create a co-evolutionary arms race. We will experiment with a simpler scenario in this lab. Rather than a robot duel, we will focus on a single robot foraging for food. We will place the robot in a large room with 10 randomly located lights, representing food, and allow it to explore for 200 steps. We will test the robot with three different random placements of the food. The initial network will begin with two input units representing the light sensor values and two output units representing the motor speeds of the left and right wheels of a simulated Pioneer robot. The fitness value will be based on the number of lights consumed by the robot.
% python eat.pyThis will take quite a while (at least an hour). The evolution is set to run for 10 generations, using a population of 20 individuals. Each fitness test involves at most 600 steps in the simulator (if the robot is ever stalled against a wall, the fitness test ends early).
% python eat.py best_chromo_NUMThis will print out a summary of the network's architecture and then convert the chromosome into a feed-forward neural network and use it to control the robot in several new random food configurations. In the text file eat-summary record how well each network performs in testing, as well as any changes in the network architecture in a table like this:
Gen Fitness DescriptionOfArch 0 1 2 ...After the table do a qualitative analysis of the robot's behavior. In other words how does it change over the course of evolution? Do improvements in behavior seem to correlate with enhancements in the network architecture?
We will be using NEAT for our midterm project. Start brainstorming
about what task you'd like to work on. Store your ideas in the
directory cs81/labs/3/midterm/. If you will need a new
simulator world create it here. Edit the file proposal to
describe your proposed task and provide a detailed explanation of the
fitness function you would use.