neat-python icon indicating copy to clipboard operation
neat-python copied to clipboard

How can we use neat-python for classification?

Open oushu1zhangxiangxuan1 opened this issue 5 years ago • 1 comments
trafficstars

Is there any ready-made loss or activation functions (like softmax and cross-entropy)for categorical labels in neat-python?

Or some best practices for classification task?

It seems now I could only do one-hot and cross-entropy in my own?

oushu1zhangxiangxuan1 avatar Dec 05 '19 13:12 oushu1zhangxiangxuan1

import numpy as np
from neat.math_util import softmax

...

net_output = net.activate(input_vector)
softmax_result = softmax(net_output)
class_output = np.argmax(((softmax_result / np.max(softmax_result)) == 1).astype(int))

avolution avatar Dec 20 '19 16:12 avolution