Documentation ¶
Index ¶
- func GetLayerTotLoss(l LossFunction, expectedX, predictedX *Matrix) float64
- func ShuffleBoth(X, Y []*Matrix)
- type Activation
- type DenseLayer
- func (l *DenseLayer) GetActivation() Activation
- func (l *DenseLayer) GetNumInputs() int
- func (l *DenseLayer) GetNumOutputs() int
- func (l *DenseLayer) PropagateValues(X *Matrix) *Matrix
- func (l *DenseLayer) TrainGradientDescent(learningRate float64, layerInputs, deltas *Matrix) *Matrix
- func (l *DenseLayer) TrainMinibatch(learningRate float64, avInputs, avDeltas *Matrix) *Matrix
- type FeedForwardNetwork
- type Layer
- type LeakyReLUActivation
- type LinearActivation
- type LossFunction
- type Matrix
- func (m *Matrix) Add(m2 *Matrix) *Matrix
- func (m *Matrix) AddValue1D(i int, v float64)
- func (m *Matrix) AddValue2D(x, y int, v float64)
- func (m *Matrix) Copy() *Matrix
- func (m *Matrix) CopyTo(m2 *Matrix)
- func (m *Matrix) CopyToSmaller(m2 *Matrix)
- func (m *Matrix) Get1DLength() int
- func (m *Matrix) GetValue1D(i int) float64
- func (m *Matrix) GetValue2D(x, y int) float64
- func (m *Matrix) Mul(f float64) *Matrix
- func (m *Matrix) SetValue1D(i int, v float64)
- func (m *Matrix) SetValue2D(x, y int, v float64)
- type MinibatchOptimizer
- type Optimizer
- type ReLUActivation
- type SGDLayer
- type SerialTrainer
- type SigmoidActivation
- type SquaredErrorLoss
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLayerTotLoss ¶
func GetLayerTotLoss(l LossFunction, expectedX, predictedX *Matrix) float64
func ShuffleBoth ¶
func ShuffleBoth(X, Y []*Matrix)
Types ¶
type Activation ¶
type Activation interface { // Calc : Calculate the activation for x Calc(x float64) float64 // Diff : Calculate the differential of the activation for x Diff(x float64) float64 }
Activation : An interface type that denotes an activations function.
type DenseLayer ¶
type DenseLayer struct { Weights Matrix Ac Activation // contains filtered or unexported fields }
DenseLayer : The standard type of dense neural network layer
func NewDenseLayer ¶
func NewDenseLayer(numInputs, numOutputs int, activation Activation) *DenseLayer
func (*DenseLayer) GetActivation ¶
func (l *DenseLayer) GetActivation() Activation
func (*DenseLayer) GetNumInputs ¶
func (l *DenseLayer) GetNumInputs() int
func (*DenseLayer) GetNumOutputs ¶
func (l *DenseLayer) GetNumOutputs() int
func (*DenseLayer) PropagateValues ¶
func (l *DenseLayer) PropagateValues(X *Matrix) *Matrix
func (*DenseLayer) TrainGradientDescent ¶
func (l *DenseLayer) TrainGradientDescent(learningRate float64, layerInputs, deltas *Matrix) *Matrix
TrainGradientDescent : DEPRECATED
func (*DenseLayer) TrainMinibatch ¶
func (l *DenseLayer) TrainMinibatch(learningRate float64, avInputs, avDeltas *Matrix) *Matrix
type FeedForwardNetwork ¶
type FeedForwardNetwork struct { Inputs int Outputs int Layers []Layer Loss LossFunction }
func NewFeedForwardNetwork ¶
func NewFeedForwardNetwork(inputs int, loss LossFunction) *FeedForwardNetwork
func (*FeedForwardNetwork) AddLayer ¶
func (n *FeedForwardNetwork) AddLayer(layer Layer)
func (*FeedForwardNetwork) GetLastLayerDeltas ¶
func (n *FeedForwardNetwork) GetLastLayerDeltas(pred, expec *Matrix) *Matrix
func (*FeedForwardNetwork) Predict ¶
func (n *FeedForwardNetwork) Predict(X *Matrix) *Matrix
func (*FeedForwardNetwork) PredictAll ¶
func (n *FeedForwardNetwork) PredictAll(Xs []*Matrix) []*Matrix
type Layer ¶
type Layer interface { // PropagateValues : Propagates an input matrix though the layer and returns the calculated matrix PropagateValues(X *Matrix) *Matrix // GetNumInputs : Gets the number of inputs GetNumInputs() int // GetNumOutputs : Gets the number of outputs GetNumOutputs() int // GetActivation : Gets the activation function of this layer GetActivation() Activation }
Layer : A interface type that describes layer in a feed forward network
type LeakyReLUActivation ¶
type LeakyReLUActivation struct { // SubZeroGradient : The gradient of the function when x < 0 SubZeroGradient float64 }
LeakyReLUActivation : A leaky ReLU activation
func (LeakyReLUActivation) Calc ¶
func (a LeakyReLUActivation) Calc(x float64) float64
func (LeakyReLUActivation) Diff ¶
func (a LeakyReLUActivation) Diff(x float64) float64
type LinearActivation ¶
LinearActivation : Activation where y=x
func (LinearActivation) Calc ¶
func (a LinearActivation) Calc(x float64) float64
func (LinearActivation) Diff ¶
func (a LinearActivation) Diff(x float64) float64
type LossFunction ¶
type Matrix ¶
func GetLayerLossDiffs ¶
func GetLayerLossDiffs(l LossFunction, expectedX, predictedX *Matrix) *Matrix
func New1DMatrix ¶
func New2DMatrix ¶
func NewZerosMatrix ¶
func (*Matrix) AddValue1D ¶
func (*Matrix) AddValue2D ¶
func (*Matrix) CopyToSmaller ¶
func (*Matrix) Get1DLength ¶
func (*Matrix) GetValue1D ¶
func (*Matrix) GetValue2D ¶
func (*Matrix) SetValue1D ¶
func (*Matrix) SetValue2D ¶
type MinibatchOptimizer ¶
func (*MinibatchOptimizer) FitBatch ¶
func (o *MinibatchOptimizer) FitBatch(n *FeedForwardNetwork, X, Y []*Matrix)
func (*MinibatchOptimizer) GetBatchSize ¶
func (o *MinibatchOptimizer) GetBatchSize() int
type Optimizer ¶
type Optimizer interface { FitBatch(n *FeedForwardNetwork, X, Y []*Matrix) GetBatchSize() int }
type ReLUActivation ¶
ReLUActivation : An activation for ReLU
func (ReLUActivation) Calc ¶
func (a ReLUActivation) Calc(x float64) float64
func (ReLUActivation) Diff ¶
func (a ReLUActivation) Diff(x float64) float64
type SerialTrainer ¶
func (*SerialTrainer) Fit ¶
func (s *SerialTrainer) Fit(n *FeedForwardNetwork, Xs, Ys []*Matrix, epochs, printRate int)
type SigmoidActivation ¶
SigmoidActivation : A sigmoid activation
func (SigmoidActivation) Calc ¶
func (a SigmoidActivation) Calc(x float64) float64
func (SigmoidActivation) Diff ¶
func (a SigmoidActivation) Diff(x float64) float64
type SquaredErrorLoss ¶
func (SquaredErrorLoss) SingleLoss ¶
func (l SquaredErrorLoss) SingleLoss(expected, predicted float64) float64
func (SquaredErrorLoss) SingleLossDiff ¶
func (l SquaredErrorLoss) SingleLossDiff(expected, predicted float64) float64
Source Files ¶
Click to show internal directories.
Click to hide internal directories.