gmalik9 / pygep Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/pygep
Automatically exported from code.google.com/p/pygep
Note that this doesn't seem to affect source distributions. Perhaps it has
something to do with setuptools?
== Platform: ==
Ubuntu Linux 6.10 w/ Python 2.5 and setuptools 0.6c3
== Steps: ==
Install pygep 0.1-beta from an egg, then:
{{{{
from pygep import chromosome
help(chromosome)
}}}
== Results: ==
We should see the module docs for pygep.chromosome, but instead we get an
error:
{{{
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site.py", line 357, in __call__
return pydoc.help(*args, **kwds)
File "/usr/lib/python2.5/pydoc.py", line 1643, in __call__
self.help(request)
File "/usr/lib/python2.5/pydoc.py", line 1687, in help
else: doc(request, 'Help on %s:')
File "/usr/lib/python2.5/pydoc.py", line 1481, in doc
pager(title % desc + '\n\n' + text.document(object, name))
File "/usr/lib/python2.5/pydoc.py", line 324, in document
if inspect.ismodule(object): return self.docmodule(*args)
File "/usr/lib/python2.5/pydoc.py", line 1072, in docmodule
contents.append(self.document(value, key, name))
File "/usr/lib/python2.5/pydoc.py", line 325, in document
if inspect.isclass(object): return self.docclass(*args)
File "/usr/lib/python2.5/pydoc.py", line 1196, in docclass
lambda t: t[1] == 'method')
File "/usr/lib/python2.5/pydoc.py", line 1146, in spill
name, mod, object))
File "/usr/lib/python2.5/pydoc.py", line 326, in document
if inspect.isroutine(object): return self.docroutine(*args)
File "/usr/lib/python2.5/pydoc.py", line 1257, in docroutine
doc = getdoc(object) or ''
File "/usr/lib/python2.5/pydoc.py", line 82, in getdoc
result = inspect.getdoc(object) or inspect.getcomments(object)
File "/usr/lib/python2.5/inspect.py", line 506, in getcomments
lines, lnum = findsource(object)
File "/usr/lib/python2.5/inspect.py", line 495, in findsource
if pat.match(lines[lnum]): break
IndexError: list index out of range
}}}
Original issue reported on code.google.com by ryanjoneil
on 14 Apr 2007 at 2:45
It should be at 0.1.2
Original issue reported on code.google.com by ryanjoneil
on 23 Apr 2007 at 2:05
We need to provide ubuntu .deb packages for PyGEP, but not until we get
closer to a 1.0 release.
Original issue reported on code.google.com by ryanjoneil
on 13 May 2007 at 11:33
It would be nice to have a significantly larger function library and to be
able to import and use related sets of those functions easily. This ticket
will be for:
- Reorganization of pygep.functions hierarchy to accommodate more:
- Add min_op, max_op, ln_op, log2_op, log10_op, etc.
- For each function package, provide an ALL (or something) tuple
- Standardization of names (all like function_op or function_linker)
- Determine whether or not to use function closure by default
Original issue reported on code.google.com by ryanjoneil
on 28 May 2007 at 2:06
At the moment, symbols longer than 1 character are truncated when
displaying chromosomes. Thus both 'd0' and 'd1' become 'd'. Instead, we
should surround longer characters by curly braces, such as '{d0}' and '{d1}'.
Original issue reported on code.google.com by ryanjoneil
on 4 May 2007 at 12:07
Currently PyGEP does gene transposition by swapping any two genes within a
chromosome. According to Ferreira, pg 91, it should choose a gene and
switch it with the first gene.
Original issue reported on code.google.com by ryanjoneil
on 2 Jun 2007 at 5:21
Per the GEP book. These will differ somewhat from vanilla Karva genes as
they require information about the current data object that is not
represented by a terminal symbol.
Original issue reported on code.google.com by ryanjoneil
on 21 Jun 2007 at 2:30
In cases where the mean fitness of a population is 0, the way reproduction
currently works will create a new generation dominated by one chromosome.
This is fundamentally incorrect. Instead, it should act as though all
fitnesses were the same positive value, which is essentially random selection.
Original issue reported on code.google.com by ryanjoneil
on 22 Apr 2007 at 3:30
Following the example "regression.py" I've written the following micro-example:
class DataPoint(object):
SAMPLE = []
LO, HI = -20.0, 20.0
SIZE = 50
RANGE = HI - LO
def __init__(self, x):
self.x = float(x)
self.y = (x ** 2) - (3.7 * x) + (7.1)
def __str__(self):
return "(" + str(self.x) + ", " + str(self.y) + ")"
@staticmethod
def populate():
for _ in xrange(DataPoint.SIZE):
x = DataPoint.LO + (random.random() * DataPoint.SIZE)
DataPoint.SAMPLE.append(DataPoint(x))
class Parabola(Chromosome):
functions = add_op, subtract_op, multiply_op, divide_op
terminals = 'x', '?'
def _fitness(self):
return 1.0 / sum(map(lambda p: ((self(p) - p.y) ** 2), DataPoint.SAMPLE)) / (DataPoint.SIZE * 1.0)
def _solved(self):
self.fitness < 0.001
if __name__ == "__main__":
DataPoint.populate()
pop = Population(Parabola, 50, 6, 1, sum_linker)
If I run it, I got this:
>>> Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/petrux/Projects/PyGEP/pygep/src/test01.py", line 42, in <module>
pop = Population(Parabola, 50, 6, 1, sum_linker)
File "pygep/population.py", line 117, in __init__
self._update_stats()
File "pygep/population.py", line 148, in _update_stats
self.mean, self.stdev, _ = stats.fitness_stats(self)
File "pygep/util/stats.py", line 32, in fitness_stats
total = sum(i.fitness for i in population)
File "pygep/util/stats.py", line 32, in <genexpr>
total = sum(i.fitness for i in population)
File "pygep/chromosome.py", line 263, in <lambda>
fitness = property(lambda self: self._fitness(), doc='Fitness value')
File "pygep/util/__init__.py", line 46, in wrapper
setattr(self, cache_name, func(self))
File "/home/petrux/Projects/PyGEP/pygep/src/test01.py", line 35, in _fitness
return 1.0 / sum(map(lambda p: ((self(p) - p.y) ** 2), DataPoint.SAMPLE)) / (DataPoint.SIZE * 1.0)
File "/home/petrux/Projects/PyGEP/pygep/src/test01.py", line 35, in <lambda>
return 1.0 / sum(map(lambda p: ((self(p) - p.y) ** 2), DataPoint.SAMPLE)) / (DataPoint.SIZE * 1.0)
File "pygep/chromosome.py", line 252, in __call__
return self.linker(*[g(obj) for g in self.genes])
File "pygep/util/__init__.py", line 81, in wrapper
memo[key] = results = func(self, key)
File "pygep/gene/karva.py", line 76, in __call__
self._evaluation[i] = allele(*args)
File "pygep/functions/mathematical/arithmetic.py", line 37, in <lambda>
divide_op = symbol('/')(lambda i, j: float(i) / j)
ZeroDivisionError: float division by zero
It seems that the random number generation allows a division by zero.
Original issue reported on code.google.com by [email protected]
on 26 Nov 2013 at 10:31
PyGEP should support RNCs (random numerical constants) per the GEP book,
2nd ed., ch 5. The way I'll probably do this is by recognizing the '?'
terminal symbol in chromosomes, so one can define a chromosome as:
class MyChromosome(Chromosome):
functions = ...
terminals = 'x', 'y', '?'
Original issue reported on code.google.com by ryanjoneil
on 2 May 2007 at 1:12
Per Ferreira, pg 66:
Mathematical Prediction:
- Number of Hits (absolute/relative)
- Precision & Selection Range (absolute/relative)
- Mean Squared Error (absolute/relative)
- R-square
Classification/Logic Synthesis:
- Number of Hits
- Hits with Penalty
- Sensitivity / Specificity
- Positive/Negative Predictive Value
Original issue reported on code.google.com by ryanjoneil
on 31 May 2007 at 1:54
Genes currently propagate errors up to whatever calls them (typically
user-provided fitness functions). If these functions mistakenly provide
instances that do not have all the terminal symbols as attributes, the user
will receive an AttributeError. On the other hand, semantically invalid
genes may sometimes through ZeroDivisionError and other exceptions. We
should catch the AttributeError and instead raise a SemanticError of our
own so that it is easy for the user to do things like:
def _fitness(self):
try:
return do_something_with(self(an_instance))
except SemanticError:
# user did something wrong
probably_quit()
except:
# anything else is OK -> inviable individual
return 0
Original issue reported on code.google.com by ryanjoneil
on 28 May 2007 at 2:17
Currently chromosome evaluation is not thread safe. Though there aren't
any explicit advantages to fitness evaluation in multiple threads right now
(due to the GIL), we should at least support it.
Original issue reported on code.google.com by ryanjoneil
on 28 May 2007 at 4:06
Can PyGep load a series of measured x,y data pairs and then predict the
best fit equation for the users input data?
Could demo code for a simple example be requested?
Thank you
Martin Trobec
Original issue reported on code.google.com by [email protected]
on 20 Jul 2008 at 5:08
PyGEP already supports NCs, but if one supplies them as integers (the most
common case) then they shall be processed solely as integers. It may be
better to treat them as floating point.
Original issue reported on code.google.com by ryanjoneil
on 28 May 2007 at 3:59
This ticket is a stub for exploring performance optimizations to
generational cycling in v0.2.
Original issue reported on code.google.com by ryanjoneil
on 19 Apr 2007 at 10:17
Though it is much faster, the biggest time sink in PyGEP is still
evaluation of Karva Genes, exclusive of the functions it calls. The
vanilla Python code is pretty compact at this point and, while it could
probably be improved still, we'd get better results for our money with a C
implementation.
Original issue reported on code.google.com by ryanjoneil
on 20 May 2007 at 1:17
When recombining existing multigenic chromosomes, most of the sub-ETs do
not change, yet they are evaluated as if they are new. It may be good to
structure multigenic chromosomes as collections of unigenic chromosomes.
That way results could be cached at the sub-ET level.
Original issue reported on code.google.com by ryanjoneil
on 19 Apr 2007 at 10:26
I initially interpreted these as the rates that a given modification
operator happened at all. Thus a 1-pt crossover rate of 0.1 meant a 10%
chance that 1-pt crossover happened a single time. However, it looks like
it should be per individual. See pg 75 of Ferreira:
"For instance, for a population of 10 individuals, a crossover rate of 0.8
means that eight different chromosomes are randomly chosen to recombine."
I'm not sure what we should do yet if a single, or odd number of
individuals are chosen for a modification requiring two. Perhaps we just
ignore the odd man out?
Original issue reported on code.google.com by ryanjoneil
on 31 May 2007 at 2:03
Per Ferreira, chapter 2.
Original issue reported on code.google.com by ryanjoneil
on 28 May 2007 at 4:08
It would nice to be able to convert chromosomes to executable Python code.
Probably in v0.3.
Original issue reported on code.google.com by ryanjoneil
on 13 May 2007 at 11:31
Traceback (most recent call last):
File "./run.py", line 73, in <module>
run(directory, 'inversion_rate', 1.0)
File "./run.py", line 54, in run
p.cycle()
File "build/bdist.linux-i686/egg/pygep/population.py", line 191, in cycle
File "build/bdist.linux-i686/egg/pygep/chromosome.py", line 297, in invert
File "/usr/lib/python2.5/random.py", line 303, in sample
raise ValueError, "sample larger than population"
ValueError: sample larger than population
Original issue reported on code.google.com by ryanjoneil
on 22 Apr 2007 at 10:00
Not sure why this works on Linux but not Windows. Both use Python 2.5.
Here's the problem using setuptools 0.6c5:
c:\python25\Scripts\easy_install.exe PyGEP
Searching for PyGEP
Reading http://cheeseshop.python.org/pypi/PyGEP/
Reading http://code.google.com/p/pygep
Reading http://code.google.com/p/pygep/downloads/list
Reading http://cheeseshop.python.org/pypi/PyGEP/0.1.2.beta-r48
Best match: PyGEP 0.1.2.beta-r48
Downloading http://pygep.googlecode.com/files/PyGEP-0.1.2.beta_r48-py2.5.egg
Processing PyGEP-0.1.2.beta_r48-py2.5.egg
Moving PyGEP-0.1.2.beta_r48-py2.5.egg to c:\python25\lib\site-packages
Adding PyGEP 0.1.2.beta-r48 to easy-install.pth file
Installed c:\python25\lib\site-packages\pygep-0.1.2.beta_r48-py2.5.egg
Processing dependencies for PyGEP
Searching for python>=2.5
Reading http://cheeseshop.python.org/pypi/python/
Couldn't find index page for 'python' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://cheeseshop.python.org/pypi/
Reading http://cheeseshop.python.org/pypi/Python/2.5
Reading http://www.python.org/2.5
Best match: Python 2.5
Downloading http://www.python.org/ftp/python/2.5/Python-2.5.tgz
^C
C:\>interrupted
Ick!
Original issue reported on code.google.com by ryanjoneil
on 30 Apr 2007 at 2:22
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.