Documentation ¶
Index ¶
- func Columns(matrix Matrix) int
- func ErrorNotSameSize(matrix, matrix2 Matrix)
- func MultipliesByTwo(x float64) float64
- func Rows(matrix Matrix) int
- func Sigmoid(x float64) float64
- func SubtractsOne(x float64) float64
- type Derivative
- type Matrix
- func ApplyFunction(matrix Matrix, fn func(x float64) float64) Matrix
- func ApplyFunctionWithIndex(matrix Matrix, fn func(i, j int, x float64) float64) Matrix
- func ApplyRate(matrix Matrix, rate float64) Matrix
- func CreateMatrix(rows, columns int) (matrix Matrix)
- func Difference(matrix, matrix2 Matrix) (resultMatrix Matrix)
- func DotProduct(matrix, matrix2 Matrix) Matrix
- func Multiplication(matrix, matrix2 Matrix) (resultMatrix Matrix)
- func RandomMatrix(rows, columns int) (matrix Matrix)
- func Sum(matrix, matrix2 Matrix) (resultMatrix Matrix)
- func Transpose(matrix Matrix) (resultMatrix Matrix)
- type Network
- func (network Network) Adjust(derivatives []Derivative)
- func (network Network) ComputeDerivatives(i int, derivatives []Derivative) Derivative
- func (network *Network) ComputeError() float64
- func (network Network) ComputeLastLayerDerivatives() Derivative
- func (network *Network) FeedBackward()
- func (network *Network) FeedForward()
- func (network *Network) Predict(input []float64) []float64
- func (network Network) Save(fileName string)
- func (network *Network) Train(iterations int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorNotSameSize ¶
func ErrorNotSameSize(matrix, matrix2 Matrix)
ErrorNotSameSize panics if the matrices do not have the same dimension
func MultipliesByTwo ¶
MultipliesByTwo takes a float and returns the float multiplied by two
func SubtractsOne ¶
SubtractsOne takes a float and returns the float subtracted by one
Types ¶
type Derivative ¶
Derivative contains the derivatives of `z` and the adjustments
type Matrix ¶
type Matrix [][]float64
Matrix is an alias for [][]float64
func ApplyFunction ¶
ApplyFunction returns a matrix where fn has been applied
func ApplyFunctionWithIndex ¶
ApplyFunctionWithIndex returns a matrix where fn has been applied with the indexes provided
func CreateMatrix ¶
CreateMatrix returns an empty matrix which is the size of rows and columns
func Difference ¶
Difference returns the difference between matrix and matrix2
func DotProduct ¶
DotProduct returns a matrix which is the result of the dot product between matrix and matrix2
func Multiplication ¶
Multiplication returns the multiplication of matrix and matrix2
func RandomMatrix ¶
RandomMatrix returns the value of a random matrix of *rows* and *columns* dimensions and where the values are between *lower* and *upper*.
type Network ¶
type Network struct { Layers []Matrix Weights []Matrix Biases []Matrix Output Matrix Rate float64 Errors []float64 Time float64 Locale string }
Network contains the Layers, Weights, Biases of a neural network then the actual output values and the learning rate.
func CreateNetwork ¶
CreateNetwork creates the network by generating the layers, weights and biases
func LoadNetwork ¶
LoadNetwork returns a Network from a specified file
func (Network) Adjust ¶
func (network Network) Adjust(derivatives []Derivative)
Adjust make the adjusts
func (Network) ComputeDerivatives ¶
func (network Network) ComputeDerivatives(i int, derivatives []Derivative) Derivative
ComputeDerivatives returns the derivatives of a specific layer l defined by i
func (*Network) ComputeError ¶
ComputeError returns the average of all the errors after the training
func (Network) ComputeLastLayerDerivatives ¶
func (network Network) ComputeLastLayerDerivatives() Derivative
ComputeLastLayerDerivatives returns the derivatives of the last layer L
func (*Network) FeedBackward ¶
func (network *Network) FeedBackward()
FeedBackward executes back propagation to adjust the weights for all the layers
func (*Network) FeedForward ¶
func (network *Network) FeedForward()
FeedForward executes forward propagation for the given inputs in the network