Documentation
¶
Index ¶
- func Apply(fn func(x float64) float64, input *mat.Dense) *mat.Dense
- func Arctan(input *mat.Dense) *mat.Dense
- func ArctanDeriv(input *mat.Dense) *mat.Dense
- func Gaussian(input *mat.Dense) *mat.Dense
- func GaussianDeriv(input *mat.Dense) *mat.Dense
- func Hmse(y_true, y_pred *mat.Dense, params []float64) float64
- func HmseDerivative(y_true, y_pred *mat.Dense, params []float64) *mat.Dense
- func Huber(y_true, y_pred *mat.Dense, params []float64) float64
- func HuberDerivative(y_true, y_pred *mat.Dense, params []float64) *mat.Dense
- func Linear(input *mat.Dense) *mat.Dense
- func LinearDeriv(input *mat.Dense) *mat.Dense
- func Mae(y_true, y_pred *mat.Dense, params []float64) float64
- func MaeDerivative(y_true, y_pred *mat.Dense, params []float64) *mat.Dense
- func Mse(y_true, y_pred *mat.Dense, params []float64) float64
- func MseDerivative(y_true, y_pred *mat.Dense, params []float64) *mat.Dense
- func ReLu(input *mat.Dense) *mat.Dense
- func ReLuDeriv(input *mat.Dense) *mat.Dense
- func Rmse(y_true, y_pred *mat.Dense, params []float64) float64
- func RmseDerivative(y_true, y_pred *mat.Dense, params []float64) *mat.Dense
- func Sigmoid(input *mat.Dense) *mat.Dense
- func SigmoidDeriv(input *mat.Dense) *mat.Dense
- func Tanh(input *mat.Dense) *mat.Dense
- func TanhDeriv(input *mat.Dense) *mat.Dense
- type Activation
- type ActivationLayer
- type ConvolutionalLayer
- type DenseLayer
- type FlattenLayer
- type Layer
- type Network
- func (net *Network) AddLayer(layerType, activationType string, output_nodes int)
- func (net *Network) Fit(x_train, y_train [][]float64, epochs int, learning_rate float64, debug bool)
- func (net *Network) Predict(input [][]float64) [][]float64
- func (net *Network) SetLoss(lossType string, params []float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Huber ¶
*
- Huber Loss Functions
- Implements a pseudo-huber loss type to approximate
- Takes in a delta value as a parameter
func Mae ¶
*
- Mean Absolute Error Loss Functions
- Derivative defaults to 1 when y_pred = y_true due to not being differentiable
Types ¶
type ActivationLayer ¶
type ActivationLayer struct { INPUT *mat.Dense OUTPUT *mat.Dense ACTIVATION Activation ACTIVATIONDERIV Activation }
*
- ActivationLayer Struct
- Contains the activation function and its derivative for the layer
func InitActivationLayer ¶
func InitActivationLayer(activation Activation, activationDeriv Activation) *ActivationLayer
*
- InitActivationLayer()
- Initializes an activation the activation function and its derivative
func (*ActivationLayer) BackPropagation ¶
func (layer *ActivationLayer) BackPropagation(output_error *mat.Dense, learning_rate float64) *mat.Dense
*
- BackPropagation()
- Performs back propagation for an activation layer required by Layer interface
- Returns matrix of error generated from derivative of activation function
func (*ActivationLayer) ForwardPropagation ¶
func (layer *ActivationLayer) ForwardPropagation(input *mat.Dense) *mat.Dense
*
- ForwardPropagation()
- Performs forward propagation for an activation layer required by Layer interface
- Returns output matrix with the function performed
type ConvolutionalLayer ¶
*
- ConvolutionalLayer Struct
- WIP
func InitConvolutionalLayer ¶
func InitConvolutionalLayer(input_size int, output_size int) *ConvolutionalLayer
*
- InitConvolutionalLayer()
- WIP
func (*ConvolutionalLayer) BackPropagation ¶
func (layer *ConvolutionalLayer) BackPropagation(output_error *mat.Dense, learning_rate float64) *mat.Dense
*
- BackPropagation()
- Performs back propagation for a convolutional layer required by Layer interface
- WIP
func (*ConvolutionalLayer) ForwardPropagation ¶
func (layer *ConvolutionalLayer) ForwardPropagation(input *mat.Dense) *mat.Dense
*
- ForwardPropagation()
- Performs forward propagation for a convolutional layer required by Layer interface
- WIP
type DenseLayer ¶
*
- DenseLayer Struct
- Contains weights and bias for a dense / fully connected layer in a neural network
func InitDenseLayer ¶
func InitDenseLayer(input_size int, output_size int) *DenseLayer
*
- InitDenseLayer()
- Initializes a dense layer given input and output shape
func (*DenseLayer) BackPropagation ¶
*
- BackPropagation()
- Performs back propagation for a dense layer required by Layer interface
- Returns matrix of the input error from the current layer
func (*DenseLayer) ForwardPropagation ¶
func (layer *DenseLayer) ForwardPropagation(input *mat.Dense) *mat.Dense
*
- ForwardPropagation()
- Performs forward propagation for a dense layer required by Layer interface
- Returns dot product of input and weights plus the bias
type FlattenLayer ¶
*
- FlattenLayer Struct
- Contains input and output matrices
func InitFlattenLayer ¶
func InitFlattenLayer(input_size int, output_size int) *FlattenLayer
*
- InitFlattenLayer()
- Flattened layer serves to simply reshape inputs and outputs
func (*FlattenLayer) BackPropagation ¶
func (layer *FlattenLayer) BackPropagation(output_error *mat.Dense, learning_rate float64) *mat.Dense
*
- BackPropagation()
- Performs back propagation for a flat layer required by Layer interface
- WIP for Convolutional Layer
func (*FlattenLayer) ForwardPropagation ¶
func (layer *FlattenLayer) ForwardPropagation(input *mat.Dense) *mat.Dense
*
- ForwardPropagation()
- Performs forward propagation for a flat layer required by Layer interface
- WIP for Convolutional Layer
func (*FlattenLayer) GetShape ¶
func (layer *FlattenLayer) GetShape() (int, int)
*
- GetShape()
- Accessor for flat layer shape
type Layer ¶
type Layer interface { ForwardPropagation(input *mat.Dense) *mat.Dense BackPropagation(output_error *mat.Dense, learning_rate float64) *mat.Dense }
*
- Layer Interface
- Defines required functions for any layer
type Network ¶
type Network struct { LAYERS []*Layer LOSSFUNC func(y_true, y_pred *mat.Dense, params []float64) float64 LOSSDERIV func(y_true, y_pred *mat.Dense, params []float64) *mat.Dense LOSSPARAMS []float64 OUTPUT_SIZE int LAYER_COUNT int }
*
- Network Struct
- Contains neural network specifics and helper functions
- Defines layers and loss functions
func (*Network) AddLayer ¶
*
- AddLayer()
- Adds specific layer to neural network given activation type and input/output neuron dimensions
func (*Network) Fit ¶
func (net *Network) Fit(x_train, y_train [][]float64, epochs int, learning_rate float64, debug bool)
*
- Fit()
- Fit the neural network given training data, number of epochs, and a learning rate
- Debug option provided for printing data from each epoch
Click to show internal directories.
Click to hide internal directories.