Archive for the 'Visualization' Category


Neural Nets and Visualization

Playing with AI is fun. That’s why I spent a lot of time trying to make a decent AI controller for Ms. Pacman and entered it into this competition. If you enjoy hard AI challenges I can definitely suggest you take a look at the competition, but ultimately I got pretty tired of Ms. Pacman 🙂

Although the best AI controller I created for Ms. Pacman used pretty simple AI, I spent a lot of time looking at several more advanced techniques, including neural nets. I never figured anything special out, but I did make a pretty flexible and fast-performing neural net in C# and a visualization using (the then pretty new) Windows Presentation Foundation – that version is in the link to the Ms. Pacman controller.


Now I’ve ported the neural net and visualization code to Flash. Take a look at the example here. It uses this test set.

The neural net has support for any amount of inputs, any amount of hidden layers with any amount of neurons as well as the most used activation functions. Also, porting the visualization was surprisingly easy going from WPF to Flash. The visualization cools (blue) when the weights (lines) and activation values for the neurons (boxes) stays unchanged, and warms (red) when they change. This can probably help you adjust the learning rate and size of the network, but beyond that it’s probably just nice to look at.

The most obvious question would be: why port a neural net to Flash from C#? The primary reason that I work with Flash is because it is so easy to get your projects into the hands of other people. I have worked with XNA for games as well, and just getting it to run on a computer without Visual Studio is beyond painful. So although I sacrifice some speed and ease of development when making hobby projects in Flash, it also gets to be a lot more fun – and usually prettier as well.

Download Source (Flash)

Download Source (C#)

June 2017
« Dec