Documentation
¶
Index ¶
- func LogisticFunc(x, a float64) float64
- type ActivationFunction
- type Criterion
- type Enter
- type Layer
- type Network
- func (n *Network) Calculate(enters []float64) []float64
- func (n *Network) CalculateLabels(enters []float64) map[string]float64
- func (n *Network) CalculateWinnerLabel(enters []float64) string
- func (n *Network) ConnectEnters()
- func (n *Network) ConnectLayers()
- func (n *Network) RandomizeSynapses()
- func (n *Network) SetActivationFunction(aFunc ActivationFunction)
- type NetworkType
- type Neuron
- type Synapse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogisticFunc ¶
LogisticFunc returns the value of the logistic function for x and a
Types ¶
type ActivationFunction ¶
ActivationFunction function definition of activation functions
func NewLogisticFunc ¶
func NewLogisticFunc(a float64) ActivationFunction
NewLogisticFunc applies and returns the Logistic function
type Criterion ¶
type Criterion int
Criterion is needed to decide if the Engine found a better working network. It functions as decider during the training.
const ( // Accuracy decides evaluation by accuracy Accuracy Criterion = iota // BalancedAccuracy decides evaluation by balanced accuracy BalancedAccuracy // FMeasure decides evaluation by f-measure FMeasure // Simple decides on simple wrong/correct ratio Simple // Distance decides evaluation by distance to ideal output Distance )
type Enter ¶
Enter represents the input vector that comes into the network
type Layer ¶
type Layer struct {
Neurons []*Neuron
}
Layer holds the neurons with their synapse connections
type Network ¶
type Network struct { Enters []*Enter Layers []*Layer Out []float64 `json:"-"` OutLabels map[int]string }
Network contains all the necessary information to use the neural network
func BuildNetwork ¶
BuildNetwork builds a neural network from parameters given
func NewNetwork ¶
NewNetwork creates a new neural network
func (*Network) CalculateLabels ¶
CalculateLabels output with all labels of output neurons
func (*Network) CalculateWinnerLabel ¶
CalculateWinnerLabel calculates the output and just returns the label of the winning euron
func (*Network) ConnectEnters ¶
func (n *Network) ConnectEnters()
ConnectEnters connects the input neurons with the first hidden layer
func (*Network) ConnectLayers ¶
func (n *Network) ConnectLayers()
ConnectLayers connects all layers with corresponding neurons
func (*Network) RandomizeSynapses ¶
func (n *Network) RandomizeSynapses()
RandomizeSynapses applies a random value to all synapses
func (*Network) SetActivationFunction ¶
func (n *Network) SetActivationFunction(aFunc ActivationFunction)
SetActivationFunction sets the activation function for the network
type NetworkType ¶
type NetworkType int
NetworkType represents the type of the neural network in terms of which task the network has. Classification and Regression are implemented.
const ( // Classification describes the mode of operation: classification Classification NetworkType = iota // Regression describes the mode of operation: regression Regression )
type Neuron ¶
type Neuron struct { OutSynapses []*Synapse InSynapses []*Synapse `json:"-"` ActivationFunction ActivationFunction `json:"-"` Out float64 `json:"-"` }
Neuron holds the neuron structure with incoming synapses, outgoing synapses, the activation function of the neuron as well as the out value.
func (*Neuron) Calculate ¶
func (n *Neuron) Calculate()
Calculate calculates the actual neuron activity
func (*Neuron) SetActivationFunction ¶
func (n *Neuron) SetActivationFunction(aFunc ActivationFunction)
SetActivationFunction sets the activation function for the neuron
type Synapse ¶
Synapse holds the synapse structure with the weight and the In and Out neuron.
func NewSynapse ¶
NewSynapse creates a new synapse with the weight
func NewSynapseFromTo ¶
NewSynapseFromTo creates a new synapse from neuron to neuron