From 1eafb0d3e3cd8ee2c370780f0d861ad21cb40e48 Mon Sep 17 00:00:00 2001 From: Iaroslav Omelianenko Date: Mon, 9 Dec 2024 18:48:13 +0200 Subject: [PATCH] Fixed value of unknown activation --- neat/math/activations.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neat/math/activations.go b/neat/math/activations.go index a79800a..8e08209 100644 --- a/neat/math/activations.go +++ b/neat/math/activations.go @@ -101,12 +101,12 @@ func NewNodeActivatorsFactory() *NodeActivatorsFactory { } // ActivateByType is to calculate activation value for give input and auxiliary parameters using activation function with specified type. -// Will return error and -0.0 activation if unsupported activation type requested. +// Will return error and -math.Inf activation if unsupported activation type requested. func (a *NodeActivatorsFactory) ActivateByType(input float64, auxParams []float64, aType NodeActivationType) (float64, error) { if fn, ok := a.activators[aType]; ok { return fn(input, auxParams), nil } else { - return -0.0, fmt.Errorf("unknown neuron activation type: %d", aType) + return math.Inf(-1), fmt.Errorf("unknown neuron activation type: %d", aType) } }