Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Genetic algorithm example/tutorial for PyBrain?

I have recently started using pyBrain to conduct some machine learning research. I am interested in GAs as well as ANNs - however despit the fact that the pyBrain homepage lists GA as one of the features of the library, there does not seem to be anything in the pyBrain documentation on GA programming (e.g. chromosome selection, fitness functions etc), and there are no examples involving GA on the PyBrain site (AFAIK).

Also, equally suprising is that all my searches to find GA examples using PyBrain have also, yielded nothing. Does anyone have a link to code that shows a GA example using pyBrain?

like image 591
Homunculus Reticulli Avatar asked Jan 06 '12 11:01

Homunculus Reticulli


2 Answers

PyBrain is a very extensive library, and its focus effectively appears to be around Neural Nets rather than optimization algorithms at large. This focus is in part reflected by the topics of most scholarly papers which make references to PyBrain.

Never the less GAs are supported in PyBrain through the Evolvable abstract class which is minimally described in the documentation page about Black-box Optimization

You are however apparently correct in your assertion that there are no PyBrain-based GA examples to be found on the Internet. The few applicable references to the Evolvable keyword for example all point to repositories of PyBrain library's own source code and minimalist examples or unit-tests...

The fact is that PyBrain is still -pun unintended- evolving; its current version is 0.3, a fair warning to would be adopters, but there appears to be enough interest and activity around the library to indicate that it could mature to be a respectable tool.

like image 135
mjv Avatar answered Nov 20 '22 09:11

mjv


Here's one.

def objF(x): return sum(x**2)
x0 = array([2.1, -1])

l = CMAES(objF, x0)
l.minimize = True
l.maxEvaluations = 200
l.learn()
like image 1
Jacob Garby Avatar answered Nov 20 '22 09:11

Jacob Garby