[SciPy-user] Has some met such a problem?

libsvm libsvm at tom.com
Wed Oct 13 09:45:07 CDT 2004


Hi everyone,

I try to learn the ga (genetic algorithm) module of scipy,
but when I run the example file in the $scipy_root/ga/ directory, it
raise the following errors.
Can someone help me? 
Any suggestion is welcome.

Best wishes,
Qingliang

Errors like this:

Warning: The key "migrants" in not a valid setting.
The valid settings are ['pop_size', 'p_replace', 'p_cross', 'p_mutate',
'p_deviation', 'gens', 'rand_seed', 'rand_alg', 'dbase', 'update_rate']
Warning: The key "num_pops" in not a valid setting.
The valid settings are ['pop_size', 'p_replace', 'p_cross', 'p_mutate',
'p_deviation', 'gens', 'rand_seed', 'rand_alg', 'dbase', 'update_rate']
initializing... seed = 1808493040
beigninning genome generation
finished generation:  0.23
evals:  250
evaluation time:  0.03
gen: 0 max: 1.6958428271114823 dev: 0.59946054180519071 eval time:
0.33999999999999997
Traceback (most recent call last):
  File "/usr/lib/python2.2/site-packages/scipy/ga/examples.py", line 64,
in ?
    ex1()
  File "/usr/lib/python2.2/site-packages/scipy/ga/examples.py", line 60,
in ex1
    galg.evolve()
  File "/usr/lib/python2.2/scipy/ga/algorithm.py", line 133, in evolve
    self.step()
  File "/usr/lib/python2.2/scipy/ga/algorithm.py", line 107, in step
    self.stats['mutations'] = self.stats['mutations'] +
self.pop[sz:].mutate()
  File "/usr/lib/python2.2/scipy/ga/population.py", line 185, in mutate
    for ind in self: mutations  =  mutations + ind.mutate()
  File "/usr/lib/python2.2/scipy/ga/genome.py", line 94, in mutate
    if self.mutator.evaluate(self):
  File "/usr/lib/python2.2/scipy/ga/genome.py", line 158, in evaluate
    for gene in genome: mutated = gene.mutate() or mutated
  File "/usr/lib/python2.2/scipy/ga/gene.py", line 104, in mutate
    self._value = self.mutator.evaluate(self)
  File "/usr/lib/python2.2/scipy/ga/gene.py", line 196, in evaluate
    f = rv.norm(old,w)[0]
AttributeError: rv_frozen instance has no attribute '__getitem__'





More information about the SciPy-user mailing list