Documentation
¶
Index ¶
- func CE(nnResult float64, expected float64) float64
- func DerivateCE(nnResult float64, expected float64) float64
- func DerivateIperbolicTangent(neuronValue float64) float64
- func DerivateLogistic(neuronValue float64) float64
- func DerivateSSE(nnResult float64, expected float64) float64
- func IperbolicTangent(neuronValue float64) float64
- func Logistic(neuronValue float64) float64
- func SSE(nnResult float64, expected float64) float64
- type NeuralNetwork
- type NeuralNetworkArguments
- type ValidationResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CE ¶
CE is the "cross-entropy" error function
func DerivateCE ¶
DerivateCE is the derivate of CE ("cross-entropy") function
func DerivateIperbolicTangent ¶
DerivateIperbolicTangent return the derivate of tanh
func DerivateLogistic ¶
DerivateLogistic is the derivate of logistic
func DerivateSSE ¶
DerivateSSE is the derivate of "sum of squared errors" function
func IperbolicTangent ¶
IperbolicTangent return the tanh value
func Logistic ¶
Logistic is the classic logistic function
Types ¶
type NeuralNetwork ¶
type NeuralNetwork struct {
// Neural Network properties
Weights [][][]float64
TotalWeights int
NrCol []int
NrRow []int
ActivationFunction func(float64) float64 `bson:"-" json:"-" dynamo:"-"`
DerivateActivation func(float64) float64 `bson:"-" json:"-" dynamo:"-"`
ErrorFunction func(float64, float64) float64 `bson:"-" json:"-" dynamo:"-"`
DerivateError func(float64, float64) float64 `bson:"-" json:"-" dynamo:"-"`
ActivationFunctionName string `bson:"-" json:"-" dynamo:"-"`
ErrorFunctionName string `bson:"-" json:"-" dynamo:"-"`
LearningRate []float64
// Neural Network configuration
Threshold float64
StepMax int64
LifeSignStep int64
LinearOutput bool
Minus float64
Plus float64
}
NeuralNetwork is the actual neural network object
func NewNeuralNetworkAndSetup ¶
func NewNeuralNetworkAndSetup(args NeuralNetworkArguments) (*NeuralNetwork, error)
NewNeuralNetworkAndSetup create a fresh new neural network struct and it inizialise it internal weights.
func (*NeuralNetwork) Predict ¶
func (n *NeuralNetwork) Predict(input []float64) ([]float64, error)
Predict permit to have a prediction of the inputs. it returns the prediction result or an error if something went wrong.
func (*NeuralNetwork) Train ¶
func (n *NeuralNetwork) Train(input [][]float64, output [][]float64) error
Train use A training dataset is a dataset of examples used for learning, that is to fit the parameters. If something went wrong an error is return.
func (*NeuralNetwork) Validate ¶
func (n *NeuralNetwork) Validate(input [][]float64, output [][]float64) (*ValidationResult, error)
Validate use a validation dataset and create and return a ValidationResult
type NeuralNetworkArguments ¶
type NeuralNetworkArguments struct {
LearningRate []float64
HiddenLayer []int
InputSize int
OutputSize int
Threshold float64
StepMax int64
LifeSignStep int64
LinearOutput bool
Minus float64
Plus float64
ActivationFunction func(float64) float64
DerivateActivation func(float64) float64
ErrorFunction func(float64, float64) float64
DerivateError func(float64, float64) float64
}
NeuralNetworkArguments permit to compact all the various arguments need by this library.
type ValidationResult ¶
type ValidationResult struct {
ConfusionMatrix [][]int
CorrectPrediction int
PredictionResult [][]float64
}
ValidationResult contain the following infos * ConfusionMatrix: A confusion matrix struct as follow:
Exspected value +---------+----+----+----+ |XXXX| | | | | |XXXX| V1 | V2 | V3 | V4 | +------------------------+ | | | | | | | V1 | 2 | 0 | 1 | 3 | +------------------------+
Predicted | | | | | |
value | V2 | 7 | 3 | 9 | 0 |
+------------------------+
| | | | | |
| V3 | 1 | 1 | 4 | 1 |
+------------------------+
| | | | | |
| V4 | 3 | 2 | 1 | 5 |
+----+----+----+----+----+
- CorrectPrediction: contain the number of prediction having distance from the exspected value < threshold.
- PredictionResult: Contain all the prediction done.
Source Files
¶
- activationfunction.go
- errorfunction.go
- rpropplus.go
- utility.go