Skip to content

Commit

Permalink
Fixed value of unknown activation
Browse files Browse the repository at this point in the history
  • Loading branch information
yaricom committed Dec 9, 2024
1 parent fff2fca commit 1eafb0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions neat/math/activations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 1eafb0d

Please sign in to comment.