Documentation ¶
Overview ¶
Package math defines standard mathematical primitives used by the NEAT algorithm as well as utility functions
Index ¶
- Variables
- func RandSign() int32
- func SingleRouletteThrow(probabilities []float64) int
- type ActivationFunction
- type ModuleActivationFunction
- type NodeActivationType
- type NodeActivatorsFactory
- func (a *NodeActivatorsFactory) ActivateByType(input float64, auxParams []float64, aType NodeActivationType) (float64, error)
- func (a *NodeActivatorsFactory) ActivateModuleByType(inputs []float64, auxParams []float64, aType NodeActivationType) ([]float64, error)
- func (a *NodeActivatorsFactory) ActivationNameFromType(aType NodeActivationType) (string, error)
- func (a *NodeActivatorsFactory) ActivationTypeFromName(name string) (NodeActivationType, error)
- func (a *NodeActivatorsFactory) Register(aType NodeActivationType, aFunc ActivationFunction, fName string)
- func (a *NodeActivatorsFactory) RegisterModule(aType NodeActivationType, aFunc ModuleActivationFunction, fName string)
Constants ¶
This section is empty.
Variables ¶
var NodeActivators = NewNodeActivatorsFactory()
NodeActivators The default node activators factory reference
Functions ¶
func RandSign ¶
func RandSign() int32
RandSign Returns subsequent random positive or negative integer value (1 or -1) to randomize value sign
func SingleRouletteThrow ¶
SingleRouletteThrow Performs a single thrown onto a roulette wheel where the wheel's space is unevenly divided. The probability that a segment will be selected is given by that segment's value in the probabilities array. Returns segment index or -1 if something goes awfully wrong
Types ¶
type ActivationFunction ¶
ActivationFunction The neuron node activation function type
type ModuleActivationFunction ¶
ModuleActivationFunction The neurons module activation function type
type NodeActivationType ¶
type NodeActivationType byte
NodeActivationType defines the type of activation function to use for the neuron node
const ( // The sigmoid activation functions SigmoidPlainActivation NodeActivationType = iota + 1 SigmoidReducedActivation SigmoidBipolarActivation SigmoidSteepenedActivation SigmoidApproximationActivation SigmoidSteepenedApproximationActivation SigmoidInverseAbsoluteActivation SigmoidLeftShiftedActivation SigmoidLeftShiftedSteepenedActivation SigmoidRightShiftedSteepenedActivation // The other activators assortment TanhActivation GaussianBipolarActivation LinearActivation LinearAbsActivation LinearClippedActivation NullActivation SignActivation SineActivation StepActivation // The modular activators (with multiple inputs/outputs) MultiplyModuleActivation MaxModuleActivation MinModuleActivation )
The neuron Activation function Types
type NodeActivatorsFactory ¶
type NodeActivatorsFactory struct {
// contains filtered or unexported fields
}
NodeActivatorsFactory The factory to provide appropriate neuron node activation function
func NewNodeActivatorsFactory ¶
func NewNodeActivatorsFactory() *NodeActivatorsFactory
NewNodeActivatorsFactory Returns node activator factory initialized with default activation functions
func (*NodeActivatorsFactory) ActivateByType ¶
func (a *NodeActivatorsFactory) ActivateByType(input float64, auxParams []float64, aType NodeActivationType) (float64, error)
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.
func (*NodeActivatorsFactory) ActivateModuleByType ¶
func (a *NodeActivatorsFactory) ActivateModuleByType(inputs []float64, auxParams []float64, aType NodeActivationType) ([]float64, error)
ActivateModuleByType will apply corresponding module activation function to the input values and returns appropriate output values. Will panic if unsupported activation function requested
func (*NodeActivatorsFactory) ActivationNameFromType ¶
func (a *NodeActivatorsFactory) ActivationNameFromType(aType NodeActivationType) (string, error)
ActivationNameFromType Returns activation function name from given type
func (*NodeActivatorsFactory) ActivationTypeFromName ¶
func (a *NodeActivatorsFactory) ActivationTypeFromName(name string) (NodeActivationType, error)
ActivationTypeFromName Parse node activation type name and return corresponding activation type
func (*NodeActivatorsFactory) Register ¶
func (a *NodeActivatorsFactory) Register(aType NodeActivationType, aFunc ActivationFunction, fName string)
Register Registers given neuron activation function with provided type and name into the factory
func (*NodeActivatorsFactory) RegisterModule ¶
func (a *NodeActivatorsFactory) RegisterModule(aType NodeActivationType, aFunc ModuleActivationFunction, fName string)
RegisterModule Registers given neuron module activation function with provided type and name into the factory