Documentation ¶
Index ¶
- Variables
- func ActivationArcTan(v float64) float64
- func ActivationArcTanDerivative(v float64) float64
- func ActivationGaussian(v float64) float64
- func ActivationGaussianDerivative(v float64) float64
- func ActivationSoftPlus(v float64) float64
- func ActivationSoftPlusDerivative(v float64) float64
- func ActivationSygmoid(v float64) float64
- func ActivationSygmoidDerivative(v float64) float64
- func ActivationTanh(v float64) float64
- func ActivationTanhDerivative(v float64) float64
- func ContoursPadding(matrix *mat.Dense, num int) *mat.Dense
- func Convolve2D(matrix, kernel *mat.Dense, channels, stride int) (*mat.Dense, error)
- func ExtractChannel(matrix *mat.Dense, rows, cols, channels, channel int) *mat.Dense
- func Flatten(matrix *mat.Dense) *mat.Dense
- func Im2Col(matrix *mat.Dense, kernelRows, kernelCols, stride int) *mat.Dense
- func Pool2D(matrix *mat.Dense, outRows, outCols, channels, windowSize, stride int, ...) (*mat.Dense, *mat.Dense, [][][2]int)
- func Reshape(matrix *mat.Dense, r, c int) (*mat.Dense, error)
- func Rot2D180(matrix *mat.Dense) *mat.Dense
- func Rot2D270(matrix *mat.Dense) *mat.Dense
- func Rot2D90(matrix *mat.Dense, times ...int) *mat.Dense
- func ZeroPadding(matrix *mat.Dense, num int) *mat.Dense
- type ConvLayer
- func (conv *ConvLayer) CalculateGradients(lossGradients *mat.Dense) error
- func (conv *ConvLayer) FeedForward(input *mat.Dense) error
- func (conv *ConvLayer) GetActivatedOutput() *mat.Dense
- func (conv *ConvLayer) GetGradients() *mat.Dense
- func (conv *ConvLayer) GetInputSize() *tensor.TDsize
- func (conv *ConvLayer) GetOutputSize() *tensor.TDsize
- func (conv *ConvLayer) GetStride() int
- func (conv *ConvLayer) GetType() string
- func (conv *ConvLayer) GetWeights() []*mat.Dense
- func (conv *ConvLayer) PrintOutput()
- func (conv *ConvLayer) PrintWeights()
- func (conv *ConvLayer) SetActivationDerivativeFunc(f func(v float64) float64)
- func (conv *ConvLayer) SetActivationFunc(f func(v float64) float64)
- func (conv *ConvLayer) SetCustomWeights(kernels []*mat.Dense)
- func (conv *ConvLayer) UpdateWeights(lp *LearningParams)
- type FullyConnectedLayer
- func (fc *FullyConnectedLayer) CalculateGradients(errorsDense *mat.Dense) error
- func (fc *FullyConnectedLayer) FeedForward(input *mat.Dense) error
- func (fc *FullyConnectedLayer) GetActivatedOutput() *mat.Dense
- func (fc *FullyConnectedLayer) GetGradients() *mat.Dense
- func (fc *FullyConnectedLayer) GetInputSize() *tensor.TDsize
- func (fc *FullyConnectedLayer) GetOutputSize() *tensor.TDsize
- func (fc *FullyConnectedLayer) GetStride() int
- func (fc *FullyConnectedLayer) GetType() string
- func (fc *FullyConnectedLayer) GetWeights() []*mat.Dense
- func (fc *FullyConnectedLayer) PrintOutput()
- func (fc *FullyConnectedLayer) PrintWeights()
- func (fc *FullyConnectedLayer) SetActivationDerivativeFunc(f func(v float64) float64)
- func (fc *FullyConnectedLayer) SetActivationFunc(f func(v float64) float64)
- func (fc *FullyConnectedLayer) SetCustomWeights(weights []*mat.Dense)
- func (fc *FullyConnectedLayer) UpdateWeights(lp *LearningParams)
- type Layer
- func NewConvLayer(inSize *tensor.TDsize, stride, kernelSize, numberFilters int) Layer
- func NewFullyConnectedLayer(inSize *tensor.TDsize, outSize int) Layer
- func NewPoolingLayer(inSize *tensor.TDsize, stride, extendFilter int, poolingType string, ...) Layer
- func NewReLULayer(inSize *tensor.TDsize) Layer
- type LayerParamsJSON
- type LearningParams
- type NestedData
- type NetJSON
- type NetLayerJSON
- type NetworkJSON
- type PoolingLayer
- func (pool *PoolingLayer) CalculateGradients(errorsDense *mat.Dense) error
- func (pool *PoolingLayer) FeedForward(input *mat.Dense) error
- func (pool *PoolingLayer) GetActivatedOutput() *mat.Dense
- func (pool *PoolingLayer) GetGradients() *mat.Dense
- func (pool *PoolingLayer) GetInputSize() *tensor.TDsize
- func (pool *PoolingLayer) GetOutputSize() *tensor.TDsize
- func (pool *PoolingLayer) GetStride() int
- func (pool *PoolingLayer) GetType() string
- func (pool *PoolingLayer) GetWeights() []*mat.Dense
- func (pool *PoolingLayer) PrintOutput()
- func (pool *PoolingLayer) PrintWeights()
- func (pool *PoolingLayer) SetActivationDerivativeFunc(f func(v float64) float64)
- func (pool *PoolingLayer) SetActivationFunc(f func(v float64) float64)
- func (pool *PoolingLayer) SetCustomWeights(t []*mat.Dense)
- func (pool *PoolingLayer) UpdateWeights(lp *LearningParams)
- type ReLULayer
- func (relu *ReLULayer) CalculateGradients(errorsDense *mat.Dense) error
- func (relu *ReLULayer) FeedForward(t *mat.Dense) error
- func (relu *ReLULayer) GetActivatedOutput() *mat.Dense
- func (relu *ReLULayer) GetGradients() *mat.Dense
- func (relu *ReLULayer) GetInputSize() *tensor.TDsize
- func (relu *ReLULayer) GetOutputSize() *tensor.TDsize
- func (relu *ReLULayer) GetStride() int
- func (relu *ReLULayer) GetType() string
- func (relu *ReLULayer) GetWeights() []*mat.Dense
- func (relu *ReLULayer) PrintOutput()
- func (relu *ReLULayer) PrintWeights()
- func (relu *ReLULayer) SetActivationDerivativeFunc(f func(v float64) float64)
- func (relu *ReLULayer) SetActivationFunc(f func(v float64) float64)
- func (relu *ReLULayer) SetCustomWeights(t []*mat.Dense)
- func (relu *ReLULayer) UpdateWeights(lp *LearningParams)
- type WholeNet
- func (wh *WholeNet) Backpropagate(Tk *mat.Dense) error
- func (wh *WholeNet) ExportToFile(fname string, saveWeights bool) error
- func (wh *WholeNet) FeedForward(input *mat.Dense) error
- func (wh *WholeNet) GetGraphvizText() (string, error)
- func (wh *WholeNet) GetOutput() *mat.Dense
- func (wh *WholeNet) ImportFromFile(fname string, randomWeights bool) error
- func (wh *WholeNet) PrintOutput()
- func (n *WholeNet) Train(inputs []*mat.Dense, desired []*mat.Dense, testData []*mat.Dense, ...) (float64, float64, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDimensionsAreNotEqual When matrix1.Dims() != matrix2.Dims() ErrDimensionsAreNotEqual = fmt.Errorf("Dimensions are not equal") // ErrNoLayers When array of layers has size 0 ErrNoLayers = fmt.Errorf("No layers in network") )
Functions ¶
func ActivationArcTan ¶
ActivationArcTan is arctan function
See the reference: http://www.wolframalpha.com/input/?i=atan(x)
func ActivationArcTanDerivative ¶
ActivationArcTanDerivative is derivative of arctan
See the reference: http://www.wolframalpha.com/input/?i=(atan(x))%27
func ActivationGaussian ¶
ActivationGaussian is gaussian function
See the reference: http://www.wolframalpha.com/input/?i=exp(-(x%5E2))
func ActivationGaussianDerivative ¶
ActivationGaussianDerivative is derivative of gaussian
See the reference: http://www.wolframalpha.com/input/?i=(exp(-(x%5E2)))%27
func ActivationSoftPlus ¶
ActivationSoftPlus is logarithmic function (ln(1+exp(x))). This is integrated sigmoid actually.
See the reference: http://www.wolframalpha.com/input/?i=ln(1%2Bexp(x)) or http://www.wolframalpha.com/input/?i=integrate(1%2F(1%2B+exp(-x)))
func ActivationSoftPlusDerivative ¶
ActivationSoftPlusDerivative is derivative of logarithm ln(1+exp(x)). This is sigmoid actually.
See the reference: http://www.wolframalpha.com/input/?i=(ln(1%2Bexp(x)))%27
func ActivationSygmoid ¶
ActivationSygmoid is sigmoid function
See the reference: http://www.wolframalpha.com/input/?i=1%2F(1%2B+exp(-x))
func ActivationSygmoidDerivative ¶
ActivationSygmoidDerivative is derivative of sigmoid
See the reference: http://www.wolframalpha.com/input/?i=(1%2F(1%2B+exp(-x)))%27
func ActivationTanh ¶
ActivationTanh is hyperbolic tangent
See the reference: http://www.wolframalpha.com/input/?i=tanh(x)
func ActivationTanhDerivative ¶
ActivationTanhDerivative is derivative of hyperbolic tangent
See the reference: http://www.wolframalpha.com/input/?i=(tanh(x))%27
func ContoursPadding ¶
ContoursPadding Apply edge padding to source matrix
matrix - source matrix num - number of columns to add and fill with edge values
func Convolve2D ¶
Convolve2D Convolution between a kernel and a matrix. See ref. https://en.wikipedia.org/wiki/Kernel_(image_processing)#Convolution
matrix - source matrix kernel - kernel itself channels - number of input channels stride - step
func ExtractChannel ¶
ExtractChannel Returns selected channel from N-channeled matrix (usefully in terms of image processing)
matrix - Source matrix rows - Number of rows (height) cols - Number of columns (width) channels - Number of channels channel - Index of channel
func Flatten ¶
Flatten Convert matrix to vector. Result is defined as NewDense(1, num of rows * num of cols, matrix data)
matrix - source matrix
func Im2Col ¶
Im2Col Convert image to column-based vector. See ref. http://cs231n.stanford.edu/slides/2016/winter1516_lecture11.pdf -> Slide "Implementing Convolutions: im2col"
matrix - source matrix kernelRows - kernel's height kernelCols - kernel's width stride - step
func Pool2D ¶
func Pool2D(matrix *mat.Dense, outRows, outCols, channels, windowSize, stride int, ptype poolingType, returnMasks bool) (*mat.Dense, *mat.Dense, [][][2]int)
Pool2D Pooling of matrix with defined window: windowSize/stride/pooling_type. See ref. https://en.wikipedia.org/wiki/Convolutional_neural_network#Pooling_layer
matrix - source matrix outRows - number of output rows outCols - number of output columns channels - number of input channels windowsSize - size of "kernel" stride - step ptype - type of pooling (max/min/avg) returnMasks - return masks ??? (for training mode)
func Reshape ¶
Reshape Reshape matrix to given r - rows(height) and c - cols(width)
Product of target dimensions should be equal to product of source dimensions
Types ¶
type ConvLayer ¶
type ConvLayer struct { Oj *mat.Dense Ok *mat.Dense Kernels []*mat.Dense PreviousDeltaKernelsState []*mat.Dense LocalDeltas []*mat.Dense NextDeltaWeightSum *mat.Dense Stride int KernelSize int OutputSize *tensor.TDsize // contains filtered or unexported fields }
ConvLayer Convolutional layer structure
Oj - O{j}, activated output from previous layer for j-th neuron (in other words: previous summation input) Ok - O{k}, activated output from current layer for k-th node (in other words: activated summation input) SumInput - non-activated output for current layer for k-th node (in other words: summation input)
func (*ConvLayer) CalculateGradients ¶
CalculateGradients Evaluate convolutional layer's gradients
func (*ConvLayer) FeedForward ¶
FeedForward Feed data to convolutional layer
func (*ConvLayer) GetActivatedOutput ¶
GetActivatedOutput Returns convolutional layer's output
func (*ConvLayer) GetGradients ¶
GetGradients Returns convolutional layer's gradients dense
func (*ConvLayer) GetInputSize ¶
GetInputSize Returns dimensions of incoming data for convolutional layer
func (*ConvLayer) GetOutputSize ¶
GetOutputSize Returns output size (dimensions) of convolutional layer
func (*ConvLayer) GetWeights ¶
GetWeights Returns convolutional layer's weights.
func (*ConvLayer) PrintOutput ¶
func (conv *ConvLayer) PrintOutput()
PrintOutput Pretty print convolutional layer's output
func (*ConvLayer) PrintWeights ¶
func (conv *ConvLayer) PrintWeights()
PrintWeights Pretty print convolutional layer's weights
func (*ConvLayer) SetActivationDerivativeFunc ¶
SetActivationDerivativeFunc Set derivative of activation function
func (*ConvLayer) SetActivationFunc ¶
SetActivationFunc Set activation function for layer
func (*ConvLayer) SetCustomWeights ¶
SetCustomWeights Set user's weights for convolutional layer (make it carefully)
kernels - slice of kernels
func (*ConvLayer) UpdateWeights ¶
func (conv *ConvLayer) UpdateWeights(lp *LearningParams)
UpdateWeights Update convolutional layer's weights
type FullyConnectedLayer ¶
type FullyConnectedLayer struct { Oj *mat.Dense Ok *mat.Dense NextDeltaWeightSum *mat.Dense Weights *mat.Dense PreviousWeightsState *mat.Dense LocalDelta *mat.Dense SumInput *mat.Dense ActivationFunc func(v float64) float64 ActivationDerivative func(v float64) float64 OutputSize *tensor.TDsize // contains filtered or unexported fields }
FullyConnectedLayer FC is simple layer structure (so this layer can be used for simple neural networks like XOR problem)
Oj - O{j}, activated output from previous layer for j-th neuron (in other words: previous summation input) Ok - O{k}, activated output from current layer for k-th node (in other words: activated summation input) SumInput - non-activated output for current layer for k-th node (in other words: summation input) LocalDelta - δ{k}, delta for current layer for k-th neuron NextDeltaWeightSum - SUM(δ{k}*w{j,k}), summation component for evaluating δ{j} for previous layer for j-th neuron Weights - w{j,k}, weight from j-th node of previous layer to k-th node of current layer
func (*FullyConnectedLayer) CalculateGradients ¶
func (fc *FullyConnectedLayer) CalculateGradients(errorsDense *mat.Dense) error
CalculateGradients Evaluate fully-connected layer's gradients
func (*FullyConnectedLayer) FeedForward ¶
func (fc *FullyConnectedLayer) FeedForward(input *mat.Dense) error
FeedForward Feed data to fully-connected layer
func (*FullyConnectedLayer) GetActivatedOutput ¶
func (fc *FullyConnectedLayer) GetActivatedOutput() *mat.Dense
GetActivatedOutput Returns fully-connected layer's output
func (*FullyConnectedLayer) GetGradients ¶
func (fc *FullyConnectedLayer) GetGradients() *mat.Dense
GetGradients Returns fully-connected layer's gradients dense
func (*FullyConnectedLayer) GetInputSize ¶
func (fc *FullyConnectedLayer) GetInputSize() *tensor.TDsize
GetInputSize Returns dimensions of incoming data for fully-connected layer
func (*FullyConnectedLayer) GetOutputSize ¶
func (fc *FullyConnectedLayer) GetOutputSize() *tensor.TDsize
GetOutputSize Returns output size (dimensions) of fully-connected layer
func (*FullyConnectedLayer) GetStride ¶
func (fc *FullyConnectedLayer) GetStride() int
GetStride Returns stride of fully-connected layer
func (*FullyConnectedLayer) GetType ¶
func (fc *FullyConnectedLayer) GetType() string
GetType Returns "fc" as layer's type
func (*FullyConnectedLayer) GetWeights ¶
func (fc *FullyConnectedLayer) GetWeights() []*mat.Dense
GetWeights Returns fully-connected layer's weights.
func (*FullyConnectedLayer) PrintOutput ¶
func (fc *FullyConnectedLayer) PrintOutput()
PrintOutput Pretty prrint fully-connected layer's output
func (*FullyConnectedLayer) PrintWeights ¶
func (fc *FullyConnectedLayer) PrintWeights()
PrintWeights Pretty print fully-connected layer's weights
func (*FullyConnectedLayer) SetActivationDerivativeFunc ¶
func (fc *FullyConnectedLayer) SetActivationDerivativeFunc(f func(v float64) float64)
SetActivationDerivativeFunc Set derivative of activation function for fully-connected layer. You need to specify function: func(v float64) float64
func (*FullyConnectedLayer) SetActivationFunc ¶
func (fc *FullyConnectedLayer) SetActivationFunc(f func(v float64) float64)
SetActivationFunc Set activation function for fully-connected layer. You need to specify function: func(v float64) float64
func (*FullyConnectedLayer) SetCustomWeights ¶
func (fc *FullyConnectedLayer) SetCustomWeights(weights []*mat.Dense)
SetCustomWeights Set user's weights for fully-connected layer (make it carefully)
func (*FullyConnectedLayer) UpdateWeights ¶
func (fc *FullyConnectedLayer) UpdateWeights(lp *LearningParams)
UpdateWeights Update fully-connected layer's weights
type Layer ¶
type Layer interface { // GetInputSize Returns dimensions of incoming data for layer GetInputSize() *tensor.TDsize // GetOutputSize Returns output size (dimensions) of layer GetOutputSize() *tensor.TDsize // GetActivatedOutput Returns activated layer's output GetActivatedOutput() *mat.Dense // GetWeights Returns layer's weights GetWeights() []*mat.Dense // GetGradients Returns layer's gradients dense GetGradients() *mat.Dense // FeedForward Feed data to layer FeedForward(input *mat.Dense) error // CalculateGradients Evaluate layers' gradients CalculateGradients(errorsDense *mat.Dense) error // UpdateWeights Call updating process for layer's weights UpdateWeights(lp *LearningParams) // PrintOutput Pretty print layer's output PrintOutput() // PrintWeights Pretty print layer's weights PrintWeights() // GetStride Returns stride of layer GetStride() int // GetType Returns type of layer in string representation GetType() string // SetActivationFunc Set activation function SetActivationFunc(f func(v float64) float64) // SetActivationDerivativeFunc Set derivative of activation function (for backpropagation) SetActivationDerivativeFunc(f func(v float64) float64) // SetCustomWeights Set provided data as layer's weights SetCustomWeights(weights []*mat.Dense) }
Layer Interface for all layer types
func NewConvLayer ¶
NewConvLayer Constructor for convolutional layer. You need to specify striding step, size (square) of kernel, amount of kernels, input size.
inSize - size of input (width/height and number of channels) stride - step on convolve operation kernelSize - width==height of kernel numberFilters - number of kernels
func NewFullyConnectedLayer ¶
NewFullyConnectedLayer Constructor for fully-connected layer. You need to specify input size and output size
func NewPoolingLayer ¶
func NewPoolingLayer(inSize *tensor.TDsize, stride, extendFilter int, poolingType string, zeroPad string) Layer
NewPoolingLayer Constructor for pooling layer.
func NewReLULayer ¶
NewReLULayer - Constructor for new ReLU layer. You need to specify input size
inSize - input layer's size
type LayerParamsJSON ¶
type LayerParamsJSON struct { Stride int `json:"stride"` KernelSize int `json:"kernel_size"` PoolingType string `json:"pooling_type"` ZeroPaddingType string `json:"zero_padding_type"` }
LayerParamsJSON JSON representation of layers attributes
type LearningParams ¶
type LearningParams struct { LearningRate float64 `json:"learning_rate"` Momentum float64 `json:"momentum"` }
LearningParams - Parameters for training neural network.
LearningRate - η Momentum - α
func NewLearningParametersDefault ¶
func NewLearningParametersDefault() *LearningParams
NewLearningParametersDefault Constructor for LearningParams
func (*LearningParams) SetEta ¶
func (lp *LearningParams) SetEta(v float64) error
SetEta Set learning rate
func (*LearningParams) SetL2Decay ¶
func (lp *LearningParams) SetL2Decay(v float64) error
SetL2Decay Set weight's decay
func (*LearningParams) SetMomentum ¶
func (lp *LearningParams) SetMomentum(v float64) error
SetMomentum Set momentum
type NestedData ¶
type NestedData struct {
Data []float64 `json:"data"`
}
NestedData JSON representation of stored data
type NetJSON ¶
type NetJSON struct { Network *NetworkJSON `json:"network"` Parameters *LearningParams `json:"parameters"` }
NetJSON JSON representation of network structure (for import and export)
type NetLayerJSON ¶
type NetLayerJSON struct { LayerType string `json:"layer_type"` InputSize *tensor.TDsize `json:"input_size"` Parameters *LayerParamsJSON `json:"parameters"` Weights []*NestedData `json:"weights"` // Actually "OutputSize" parameter is useful for fully-connected layer only // There are automatic calculation of output size for other layers' types OutputSize *tensor.TDsize `json:"output_size"` }
NetLayerJSON JSON representation of layer
type NetworkJSON ¶
type NetworkJSON struct {
Layers []*NetLayerJSON `json:"layers"`
}
NetworkJSON JSON representation of networks' layers
type PoolingLayer ¶
type PoolingLayer struct { Oj *mat.Dense Ok *mat.Dense Masks *mat.Dense Stride int ExtendFilter int OutputSize *tensor.TDsize PoolingType poolingType ZeroPadding zeroPaddingType // contains filtered or unexported fields }
PoolingLayer Pooling layer structure
Oj - Input data Ok - Output data LocalDelta - Gradients
func (*PoolingLayer) CalculateGradients ¶
func (pool *PoolingLayer) CalculateGradients(errorsDense *mat.Dense) error
CalculateGradients Evaluate pooling layer's gradients
func (*PoolingLayer) FeedForward ¶
func (pool *PoolingLayer) FeedForward(input *mat.Dense) error
FeedForward Feed data to pooling layer
func (*PoolingLayer) GetActivatedOutput ¶
func (pool *PoolingLayer) GetActivatedOutput() *mat.Dense
GetActivatedOutput Returns pooling layer's output
func (*PoolingLayer) GetGradients ¶
func (pool *PoolingLayer) GetGradients() *mat.Dense
GetGradients Returns pooling layer's gradients
func (*PoolingLayer) GetInputSize ¶
func (pool *PoolingLayer) GetInputSize() *tensor.TDsize
GetInputSize Returns dimensions of incoming data for pooling layer
func (*PoolingLayer) GetOutputSize ¶
func (pool *PoolingLayer) GetOutputSize() *tensor.TDsize
GetOutputSize Returns output size (dimensions) of pooling layer
func (*PoolingLayer) GetStride ¶
func (pool *PoolingLayer) GetStride() int
GetStride Returns stride of layer
func (*PoolingLayer) GetType ¶
func (pool *PoolingLayer) GetType() string
GetType Returns "pool" as layer's type
func (*PoolingLayer) GetWeights ¶
func (pool *PoolingLayer) GetWeights() []*mat.Dense
GetWeights Returns pooling layer's weights
func (*PoolingLayer) PrintOutput ¶
func (pool *PoolingLayer) PrintOutput()
PrintOutput Pretty print pooling layer's output
func (*PoolingLayer) PrintWeights ¶
func (pool *PoolingLayer) PrintWeights()
PrintWeights Just to point, that pooling layer has not gradients
func (*PoolingLayer) SetActivationDerivativeFunc ¶
func (pool *PoolingLayer) SetActivationDerivativeFunc(f func(v float64) float64)
SetActivationDerivativeFunc Set derivative of activation function
func (*PoolingLayer) SetActivationFunc ¶
func (pool *PoolingLayer) SetActivationFunc(f func(v float64) float64)
SetActivationFunc Set activation function for layer
func (*PoolingLayer) SetCustomWeights ¶
func (pool *PoolingLayer) SetCustomWeights(t []*mat.Dense)
SetCustomWeights Set user's weights (make it carefully) for pooling layer
func (*PoolingLayer) UpdateWeights ¶
func (pool *PoolingLayer) UpdateWeights(lp *LearningParams)
UpdateWeights Just to point, that pooling layer does NOT updating weights
type ReLULayer ¶
type ReLULayer struct { Oj *mat.Dense Ok *mat.Dense LocalDelta *mat.Dense OutputSize *tensor.TDsize // contains filtered or unexported fields }
ReLULayer Rectified Linear Unit layer (activation: max(0, x))
Oj - Input data Ok - Output data LocalDelta - Incoming gradients*weights (backpropagation)
func (*ReLULayer) CalculateGradients ¶
CalculateGradients Evaluate ReLU layer's gradients
func (*ReLULayer) FeedForward ¶
FeedForward - Feed data to ReLU layer
func (*ReLULayer) GetActivatedOutput ¶
GetActivatedOutput Returns ReLU layer's output
func (*ReLULayer) GetGradients ¶
GetGradients Returns ReLU layer's gradients
func (*ReLULayer) GetInputSize ¶
GetInputSize Returns dimensions of incoming data for ReLU layer
func (*ReLULayer) GetOutputSize ¶
GetOutputSize Returns output size (dimensions) of ReLU layer
func (*ReLULayer) GetWeights ¶
GetWeights Returns ReLU layer's weights
func (*ReLULayer) PrintOutput ¶
func (relu *ReLULayer) PrintOutput()
PrintOutput Pretty print ReLU layer's output
func (*ReLULayer) PrintWeights ¶
func (relu *ReLULayer) PrintWeights()
PrintWeights Just to point, that ReLU layer has not weights
func (*ReLULayer) SetActivationDerivativeFunc ¶
SetActivationDerivativeFunc Set derivative of activation function
func (*ReLULayer) SetActivationFunc ¶
SetActivationFunc Set activation function for layer
func (*ReLULayer) SetCustomWeights ¶
SetCustomWeights Set user's weights for ReLU layer (make it carefully)
func (*ReLULayer) UpdateWeights ¶
func (relu *ReLULayer) UpdateWeights(lp *LearningParams)
UpdateWeights Just to point, that ReLU layer does NOT updating weights
type WholeNet ¶
type WholeNet struct { Layers []Layer LP *LearningParams }
WholeNet Neural net itself (slice of layers)
func (*WholeNet) Backpropagate ¶
Backpropagate Backward pass through the net (training)
func (*WholeNet) ExportToFile ¶
ExportToFile Save network structure and its weights to JSON file
func (*WholeNet) FeedForward ¶
FeedForward Forward pass through the net
func (*WholeNet) GetGraphvizText ¶
GetGraphvizText Returns Graphviz text-based output
func (*WholeNet) ImportFromFile ¶
ImportFromFile Load network to file
fname - filename, randomWeights: true: random weights for new network false: weights from files for using network (or continue training))
func (*WholeNet) PrintOutput ¶
func (wh *WholeNet) PrintOutput()
PrintOutput Print net's output (last layer output)
func (*WholeNet) Train ¶
func (n *WholeNet) Train(inputs []*mat.Dense, desired []*mat.Dense, testData []*mat.Dense, testDesired []*mat.Dense, epochsNum int) (float64, float64, error)
Train Train neural network
inputs - input data for training desired - target outputs for input testData - input data for doing tests testDesired - target outputs for testing epochsNum - number of epochs
Source Files ¶
- activation_functions.go
- contours_padding.go
- convolutional_layer.go
- convolve_2d.go
- errors.go
- export_network.go
- flatten.go
- fully_connected_layer.go
- im2col.go
- import_network.go
- layer.go
- network.go
- optimization_learning.go
- pool_2d.go
- pooling_layer.go
- relu_layer.go
- reshape.go
- rotate.go
- train_process.go
- zero_padding.go