0

I'm currently implementing a program classifier for my coursework. My lecturer ask me to use "Evolving ANN" algorithm. So I found a package called NEAT (Neuro Evolution of Augmenting Topologies). I have 10 inputs and 7 outputs, then I just modify the source from its documentation.

def eval_fitness(genomes):
for g in genomes:
    net = nn.create_feed_forward_phenotype(g)

    mse = 0

    for inputs, expected in zip(alldata, label):
        output = net.serial_activate(inputs)
        output = np.clip(output, -1, 1)
        mse += (output - expected) ** 2

    g.fitness = 1 - (mse/44000) #44000 is the number of samples
    print(g.fitness)

I had changed the config file too, so the program has 10 inputs and 7 outputs. But when I try to run the code, it gives me error

Traceback (most recent call last):
  File "/home/ilhammaziz/PycharmProjects/tuproSC2/eANN.py", line 40, in <module>
    pop.run(eval_fitness, 10)
  File "/home/ilhammaziz/.local/lib/python3.5/site-packages/neat/population.py", line 190, in run
    best = max(population)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

What I supposed to do? Thanks

  • Is there any specific reason to have chosen NEAT and what did your professor mean by 'Evolving ANN' algorithm, would a simple multi layer perceptron fallin this category? – Ironluca Dec 14 '16 at 13:39
  • Actually I have no reason choosing NEAT, 'Evolving ANN' I think it as same as neuro-evolution. References for neat http://neat-python.readthedocs.io/en/latest/index.html – Ilham Muhammad Dec 14 '16 at 14:40

1 Answers1

1

As far as I can tell the error is not in your code but in the library it self. Just use a different one. This one looks promising to me.

PLEXATIC
  • 353
  • 1
  • 5