Documentation ¶
Index ¶
- func LikeInf(x float64) bool
- func LikeZero(x float64) bool
- func RandomChaos() float64
- func RandomGuassian(mu, std float64) float64
- func RandomLinear(a, b float64) float64
- func RandomSeed()
- func RandomStandardGuassian() float64
- func Relu(x float64) float64
- func ReluDerivative(x float64) float64
- func Sigmoid(x float64) float64
- func SigmoidDerivative(x float64) float64
- func Tanh(x float64) float64
- func TanhDerivative(x float64) float64
- type ActionOfLayerRecordShadow
- type CacheLayer
- type DeltaLayer
- type Layer
- type LayerActivation
- type LayerBase
- func (c *LayerBase) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
- func (c *LayerBase) CorrectDelta(delta []*SimpleMatrix, offset int)
- func (c *LayerBase) Delta() []*SimpleMatrix
- func (c *LayerBase) DeltaN() int
- func (c *LayerBase) ForwardProp(input *SimpleMatrix) *SimpleMatrix
- func (c *LayerBase) InputDim() (int, int)
- func (c *LayerBase) LastGrad() *SimpleMatrix
- func (c *LayerBase) LastInput() *SimpleMatrix
- func (c *LayerBase) LastOutput() *SimpleMatrix
- func (c *LayerBase) LoadLastInput(input *SimpleMatrix)
- func (c *LayerBase) LoadLastOutput(output *SimpleMatrix)
- func (c *LayerBase) OutputDim() (int, int)
- func (c *LayerBase) ParamsUpdate(alpha float64)
- type LayerConvolution
- func (c *LayerConvolution) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
- func (c *LayerConvolution) CorrectDelta(delta []*SimpleMatrix, offset int)
- func (c *LayerConvolution) Delta() []*SimpleMatrix
- func (c *LayerConvolution) DeltaN() int
- func (c *LayerConvolution) ForwardProp(input *SimpleMatrix) *SimpleMatrix
- func (c *LayerConvolution) InputDim() (int, int)
- func (c *LayerConvolution) OutputDim() (int, int)
- func (c *LayerConvolution) ParamsUpdate(alpha float64)
- type LayerFlatten
- func (c *LayerFlatten) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
- func (c *LayerFlatten) CorrectDelta(delta []*SimpleMatrix, offset int)
- func (c *LayerFlatten) Delta() []*SimpleMatrix
- func (c *LayerFlatten) DeltaN() int
- func (c *LayerFlatten) ForwardProp(input *SimpleMatrix) *SimpleMatrix
- func (c *LayerFlatten) InputDim() (int, int)
- func (c *LayerFlatten) OutputDim() (int, int)
- func (c *LayerFlatten) ParamsUpdate(alpha float64)
- type LayerLinear
- func (c *LayerLinear) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
- func (c *LayerLinear) CorrectDelta(delta []*SimpleMatrix, offset int)
- func (c *LayerLinear) Delta() []*SimpleMatrix
- func (c *LayerLinear) DeltaN() int
- func (c *LayerLinear) ForwardProp(input *SimpleMatrix) *SimpleMatrix
- func (c *LayerLinear) InputDim() (int, int)
- func (c *LayerLinear) OutputDim() (int, int)
- func (c *LayerLinear) ParamsUpdate(alpha float64)
- type LayerLogRegression
- func (c *LayerLogRegression) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
- func (c *LayerLogRegression) ForwardProp(input *SimpleMatrix) *SimpleMatrix
- func (c *LayerLogRegression) InputDim() (int, int)
- func (c *LayerLogRegression) Loss(output, output_pred *SimpleMatrix) *SimpleMatrix
- func (c *LayerLogRegression) OutputDim() (int, int)
- func (c *LayerLogRegression) Setup()
- type LayerPoolMax
- func (c *LayerPoolMax) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
- func (c *LayerPoolMax) CorrectDelta(delta []*SimpleMatrix, offset int)
- func (c *LayerPoolMax) Delta() []*SimpleMatrix
- func (c *LayerPoolMax) DeltaN() int
- func (c *LayerPoolMax) ForwardProp(input *SimpleMatrix) *SimpleMatrix
- func (c *LayerPoolMax) InputDim() (int, int)
- func (c *LayerPoolMax) LastContribution() *SimpleMatrix
- func (c *LayerPoolMax) OutputDim() (int, int)
- func (c *LayerPoolMax) ParamsUpdate(alpha float64)
- type LayerRecordShadow
- func (c *LayerRecordShadow) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
- func (c *LayerRecordShadow) Current() *SimpleMatrix
- func (c *LayerRecordShadow) ForwardProp(input *SimpleMatrix) *SimpleMatrix
- func (c *LayerRecordShadow) MoveNext() *LayerRecordShadow
- func (c *LayerRecordShadow) MovePrev() *LayerRecordShadow
- func (c *LayerRecordShadow) Next() *SimpleMatrix
- func (c *LayerRecordShadow) ParamsUpdate(alpha float64)
- func (c *LayerRecordShadow) Prev() *SimpleMatrix
- func (c *LayerRecordShadow) SwitchContext(i int) *LayerRecordShadow
- type LayerSelfishShadow
- func (c *LayerSelfishShadow) Activate(copy_input, copy_output, copy_grad bool) *LayerSelfishShadow
- func (c *LayerSelfishShadow) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
- func (c *LayerSelfishShadow) CorrectDelta(delta []*SimpleMatrix, offset int)
- func (c *LayerSelfishShadow) Delta() []*SimpleMatrix
- func (c *LayerSelfishShadow) DeltaN() int
- func (c *LayerSelfishShadow) ForwardProp(input *SimpleMatrix) *SimpleMatrix
- func (c *LayerSelfishShadow) InputDim() (int, int)
- func (c *LayerSelfishShadow) OutputDim() (int, int)
- func (c *LayerSelfishShadow) ParamsUpdate(alpha float64)
- type LayerShadow
- func (c *LayerShadow) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
- func (c *LayerShadow) CorrectDelta(delta []*SimpleMatrix, offset int)
- func (c *LayerShadow) Delta() []*SimpleMatrix
- func (c *LayerShadow) DeltaN() int
- func (c *LayerShadow) ForwardProp(input *SimpleMatrix) *SimpleMatrix
- func (c *LayerShadow) InputDim() (int, int)
- func (c *LayerShadow) LastGrad() *SimpleMatrix
- func (c *LayerShadow) LastInput() *SimpleMatrix
- func (c *LayerShadow) LastOutput() *SimpleMatrix
- func (c *LayerShadow) LoadLastInput(input *SimpleMatrix)
- func (c *LayerShadow) LoadLastOutput(output *SimpleMatrix)
- func (c *LayerShadow) OutputDim() (int, int)
- func (c *LayerShadow) ParamsUpdate(alpha float64)
- type LossMixin
- type NeuralChain
- func (n *NeuralChain) AddLayer(layer Layer) NeuralNetwork
- func (c *NeuralChain) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
- func (c *NeuralChain) CorrectDelta(delta []*SimpleMatrix, offset int)
- func (c *NeuralChain) CorrectLayerDelta(delta []*SimpleMatrix, offset, layerIndex int)
- func (c *NeuralChain) DefineInputDim(m, n int) *NeuralChain
- func (c *NeuralChain) Delta() []*SimpleMatrix
- func (c *NeuralChain) DeltaN() int
- func (n *NeuralChain) Error(predict, expect *SimpleMatrix) float64
- func (n *NeuralChain) Fit(input, expect *SimpleMatrix, alpha float64) NeuralNetwork
- func (c *NeuralChain) ForwardProp(input *SimpleMatrix) *SimpleMatrix
- func (c *NeuralChain) InputDim() (int, int)
- func (n *NeuralChain) Learn(predict *SimpleMatrix, expect *SimpleMatrix) NeuralNetwork
- func (c *NeuralChain) OutputDim() (int, int)
- func (c *NeuralChain) ParamsUpdate(alpha float64)
- func (n *NeuralChain) Predict(input *SimpleMatrix) *SimpleMatrix
- func (n *NeuralChain) Update(alpha float64) NeuralNetwork
- type NeuralNetwork
- type NeuralRecurrentChain
- type NopActionOfLayerRecordShadow
- func (a *NopActionOfLayerRecordShadow) DeltaApply(c *LayerRecordShadow, alpha float64)
- func (a *NopActionOfLayerRecordShadow) DeltaUpdate(c *LayerRecordShadow)
- func (a *NopActionOfLayerRecordShadow) GradPlus(c *LayerRecordShadow, grad *SimpleMatrix) *SimpleMatrix
- func (a *NopActionOfLayerRecordShadow) InputPlus(c *LayerRecordShadow, input *SimpleMatrix) *SimpleMatrix
- func (a *NopActionOfLayerRecordShadow) Record(c *LayerRecordShadow)
- func (a *NopActionOfLayerRecordShadow) ResetRecord(c *LayerRecordShadow)
- type RecordInputDelayUpdateOfLayerRecordShadow
- type RecordInputOfLayerRecordShadow
- type RecordOutputDelayUpdateOfLayerRecordShadow
- type RecordOutputOfLayerRecordShadow
- type RecurrenceOfLayerRecordShadow
- func (a *RecurrenceOfLayerRecordShadow) DeltaApply(c *LayerRecordShadow, alpha float64)
- func (a *RecurrenceOfLayerRecordShadow) DeltaUpdate(c *LayerRecordShadow)
- func (a *RecurrenceOfLayerRecordShadow) GradPlus(c *LayerRecordShadow, grad *SimpleMatrix) *SimpleMatrix
- func (a *RecurrenceOfLayerRecordShadow) Init(record_m, record_n int) *RecurrenceOfLayerRecordShadow
- func (a *RecurrenceOfLayerRecordShadow) InitFill(h *SimpleMatrix) *RecurrenceOfLayerRecordShadow
- func (a *RecurrenceOfLayerRecordShadow) InputPlus(c *LayerRecordShadow, input *SimpleMatrix) *SimpleMatrix
- func (a *RecurrenceOfLayerRecordShadow) ResetRecord(c *LayerRecordShadow)
- type SimpleMatrix
- func (X *SimpleMatrix) Add(Y *SimpleMatrix, a1, a2 float64) *SimpleMatrix
- func (X *SimpleMatrix) Clone() *SimpleMatrix
- func (X *SimpleMatrix) Col(x int) *SimpleMatrix
- func (X *SimpleMatrix) ConnectBottom(Y *SimpleMatrix) *SimpleMatrix
- func (X *SimpleMatrix) ConnectLeft(Y *SimpleMatrix) *SimpleMatrix
- func (X *SimpleMatrix) ConnectRight(Y *SimpleMatrix) *SimpleMatrix
- func (X *SimpleMatrix) ConnectTop(Y *SimpleMatrix) *SimpleMatrix
- func (X *SimpleMatrix) Convolute(Kernel *SimpleMatrix) *SimpleMatrix
- func (X *SimpleMatrix) Dot(Y *SimpleMatrix) *SimpleMatrix
- func (X *SimpleMatrix) Dump()
- func (X *SimpleMatrix) EltMax() float64
- func (X *SimpleMatrix) EltMin() float64
- func (X *SimpleMatrix) EltMul(Y *SimpleMatrix) *SimpleMatrix
- func (X *SimpleMatrix) EltSum() float64
- func (X *SimpleMatrix) Fill(x float64) *SimpleMatrix
- func (X *SimpleMatrix) FillElt(x []float64) *SimpleMatrix
- func (X *SimpleMatrix) FillGuassian(mu, std float64) *SimpleMatrix
- func (X *SimpleMatrix) FillRandom(a, b float64) *SimpleMatrix
- func (X *SimpleMatrix) FillWindow(y, x int, Y *SimpleMatrix) *SimpleMatrix
- func (X *SimpleMatrix) FillWindowMap(y, x int, Y *SimpleMatrix, f func(float64, float64) float64) *SimpleMatrix
- func (X *SimpleMatrix) Map(f func(float64) float64) *SimpleMatrix
- func (X *SimpleMatrix) MapWindow(m, n, h, w int, f func(float64) float64) *SimpleMatrix
- func (X *SimpleMatrix) MirrorM() *SimpleMatrix
- func (X *SimpleMatrix) MirrorN() *SimpleMatrix
- func (X *SimpleMatrix) Pool(pool_m, pool_n, stride_m, stride_n int, f func(float64, float64) float64, ...) *SimpleMatrix
- func (X *SimpleMatrix) Reduce(f func(float64, float64) float64, init float64) float64
- func (X *SimpleMatrix) ReduceWindow(m, n, h, w int, f func(float64, float64) float64, init float64) float64
- func (X *SimpleMatrix) Reshape(m, n int) *SimpleMatrix
- func (X *SimpleMatrix) Row(x int) *SimpleMatrix
- func (X *SimpleMatrix) SacleWindow(m, n, h, w int, a float64) *SimpleMatrix
- func (X *SimpleMatrix) Scale(a float64) *SimpleMatrix
- func (X *SimpleMatrix) Softmax() *SimpleMatrix
- func (X *SimpleMatrix) T() *SimpleMatrix
- func (X *SimpleMatrix) Window(y, x, h, w int) *SimpleMatrix
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomChaos ¶
func RandomChaos() float64
func RandomGuassian ¶
func RandomLinear ¶
func RandomSeed ¶
func RandomSeed()
func RandomStandardGuassian ¶
func RandomStandardGuassian() float64
func ReluDerivative ¶
func SigmoidDerivative ¶
func TanhDerivative ¶
Types ¶
type ActionOfLayerRecordShadow ¶
type ActionOfLayerRecordShadow interface { ResetRecord(layer *LayerRecordShadow) Record(layer *LayerRecordShadow) InputPlus(layer *LayerRecordShadow, input *SimpleMatrix) *SimpleMatrix GradPlus(layer *LayerRecordShadow, grad *SimpleMatrix) *SimpleMatrix DeltaUpdate(layer *LayerRecordShadow) DeltaApply(layer *LayerRecordShadow, alpha float64) }
type CacheLayer ¶
type CacheLayer interface { LastInput() *SimpleMatrix LastOutput() *SimpleMatrix LastGrad() *SimpleMatrix LoadLastInput(input *SimpleMatrix) LoadLastOutput(output *SimpleMatrix) }
type DeltaLayer ¶
type DeltaLayer interface { DeltaN() int Delta() []*SimpleMatrix CorrectDelta(delta []*SimpleMatrix, offset int) }
type Layer ¶
type Layer interface { CacheLayer DeltaLayer OutputDim() (int, int) InputDim() (int, int) // Calculate layer output for given input (forward propagation). ForwardProp(input *SimpleMatrix) *SimpleMatrix // Calculate input gradient. BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix // Update layer parameter gradients as calculated from BackwardProp(). ParamsUpdate(alpha float64) }
type LayerActivation ¶
func NewLayerActivation ¶
func NewLayerActivation(input_m, input_n int, fun_type string) *LayerActivation
func (*LayerActivation) BackwardProp ¶
func (c *LayerActivation) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
func (*LayerActivation) ForwardProp ¶
func (c *LayerActivation) ForwardProp(input *SimpleMatrix) *SimpleMatrix
func (*LayerActivation) InputDim ¶
func (c *LayerActivation) InputDim() (int, int)
func (*LayerActivation) OutputDim ¶
func (c *LayerActivation) OutputDim() (int, int)
type LayerBase ¶
type LayerBase struct { Layer // contains filtered or unexported fields }
func (*LayerBase) BackwardProp ¶
func (c *LayerBase) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
func (*LayerBase) CorrectDelta ¶
func (c *LayerBase) CorrectDelta(delta []*SimpleMatrix, offset int)
func (*LayerBase) Delta ¶
func (c *LayerBase) Delta() []*SimpleMatrix
func (*LayerBase) ForwardProp ¶
func (c *LayerBase) ForwardProp(input *SimpleMatrix) *SimpleMatrix
func (*LayerBase) LastGrad ¶
func (c *LayerBase) LastGrad() *SimpleMatrix
func (*LayerBase) LastInput ¶
func (c *LayerBase) LastInput() *SimpleMatrix
func (*LayerBase) LastOutput ¶
func (c *LayerBase) LastOutput() *SimpleMatrix
func (*LayerBase) LoadLastInput ¶
func (c *LayerBase) LoadLastInput(input *SimpleMatrix)
func (*LayerBase) LoadLastOutput ¶
func (c *LayerBase) LoadLastOutput(output *SimpleMatrix)
func (*LayerBase) ParamsUpdate ¶
type LayerConvolution ¶
type LayerConvolution struct { LayerBase W, B *SimpleMatrix DeltaWb []*SimpleMatrix WeightDecay float64 InputM, M, N, ItemM, ItemN, KernelM, KernelN int }
func NewLayerConvolution ¶
func NewLayerConvolution( input_m, input_n, output_n int, item_m, item_n, kernel_m, kernel_n int, weight_decay float64, ) *LayerConvolution
func (*LayerConvolution) BackwardProp ¶
func (c *LayerConvolution) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
func (*LayerConvolution) CorrectDelta ¶
func (c *LayerConvolution) CorrectDelta(delta []*SimpleMatrix, offset int)
func (*LayerConvolution) Delta ¶
func (c *LayerConvolution) Delta() []*SimpleMatrix
func (*LayerConvolution) DeltaN ¶
func (c *LayerConvolution) DeltaN() int
func (*LayerConvolution) ForwardProp ¶
func (c *LayerConvolution) ForwardProp(input *SimpleMatrix) *SimpleMatrix
func (*LayerConvolution) InputDim ¶
func (c *LayerConvolution) InputDim() (int, int)
func (*LayerConvolution) OutputDim ¶
func (c *LayerConvolution) OutputDim() (int, int)
func (*LayerConvolution) ParamsUpdate ¶
func (c *LayerConvolution) ParamsUpdate(alpha float64)
type LayerFlatten ¶
func NewLayerFlatten ¶
func NewLayerFlatten(input_m, input_n int) *LayerFlatten
func (*LayerFlatten) BackwardProp ¶
func (c *LayerFlatten) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
func (*LayerFlatten) CorrectDelta ¶
func (c *LayerFlatten) CorrectDelta(delta []*SimpleMatrix, offset int)
func (*LayerFlatten) Delta ¶
func (c *LayerFlatten) Delta() []*SimpleMatrix
func (*LayerFlatten) DeltaN ¶
func (c *LayerFlatten) DeltaN() int
func (*LayerFlatten) ForwardProp ¶
func (c *LayerFlatten) ForwardProp(input *SimpleMatrix) *SimpleMatrix
func (*LayerFlatten) InputDim ¶
func (c *LayerFlatten) InputDim() (int, int)
func (*LayerFlatten) OutputDim ¶
func (c *LayerFlatten) OutputDim() (int, int)
func (*LayerFlatten) ParamsUpdate ¶
func (c *LayerFlatten) ParamsUpdate(alpha float64)
type LayerLinear ¶
type LayerLinear struct { LayerBase W, B *SimpleMatrix DeltaWb []*SimpleMatrix // W, b WeightScale, WeightDecay float64 EnableB bool }
func NewLayerLinear ¶
func NewLayerLinear(input_m, input_n, output_n int, weight_scale, weight_decay float64, enable_b bool) *LayerLinear
func (*LayerLinear) BackwardProp ¶
func (c *LayerLinear) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
func (*LayerLinear) CorrectDelta ¶
func (c *LayerLinear) CorrectDelta(delta []*SimpleMatrix, offset int)
func (*LayerLinear) Delta ¶
func (c *LayerLinear) Delta() []*SimpleMatrix
func (*LayerLinear) DeltaN ¶
func (c *LayerLinear) DeltaN() int
func (*LayerLinear) ForwardProp ¶
func (c *LayerLinear) ForwardProp(input *SimpleMatrix) *SimpleMatrix
func (*LayerLinear) InputDim ¶
func (c *LayerLinear) InputDim() (int, int)
func (*LayerLinear) OutputDim ¶
func (c *LayerLinear) OutputDim() (int, int)
func (*LayerLinear) ParamsUpdate ¶
func (c *LayerLinear) ParamsUpdate(alpha float64)
type LayerLogRegression ¶
func NewLayerLogRegression ¶
func NewLayerLogRegression(input_m, input_n int) *LayerLogRegression
func (*LayerLogRegression) BackwardProp ¶
func (c *LayerLogRegression) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
func (*LayerLogRegression) ForwardProp ¶
func (c *LayerLogRegression) ForwardProp(input *SimpleMatrix) *SimpleMatrix
func (*LayerLogRegression) InputDim ¶
func (c *LayerLogRegression) InputDim() (int, int)
func (*LayerLogRegression) Loss ¶
func (c *LayerLogRegression) Loss(output, output_pred *SimpleMatrix) *SimpleMatrix
func (*LayerLogRegression) OutputDim ¶
func (c *LayerLogRegression) OutputDim() (int, int)
func (*LayerLogRegression) Setup ¶
func (c *LayerLogRegression) Setup()
type LayerPoolMax ¶
type LayerPoolMax struct { LayerBase InputM, InputN, ItemM, ItemN int M, N, PoolM, PoolN int // contains filtered or unexported fields }
func NewLayerPoolMax ¶
func NewLayerPoolMax(input_m, input_n, item_n, item_m, pool_m, pool_n int) *LayerPoolMax
func (*LayerPoolMax) BackwardProp ¶
func (c *LayerPoolMax) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
func (*LayerPoolMax) CorrectDelta ¶
func (c *LayerPoolMax) CorrectDelta(delta []*SimpleMatrix, offset int)
func (*LayerPoolMax) Delta ¶
func (c *LayerPoolMax) Delta() []*SimpleMatrix
func (*LayerPoolMax) DeltaN ¶
func (c *LayerPoolMax) DeltaN() int
func (*LayerPoolMax) ForwardProp ¶
func (c *LayerPoolMax) ForwardProp(input *SimpleMatrix) *SimpleMatrix
func (*LayerPoolMax) InputDim ¶
func (c *LayerPoolMax) InputDim() (int, int)
func (*LayerPoolMax) LastContribution ¶
func (c *LayerPoolMax) LastContribution() *SimpleMatrix
func (*LayerPoolMax) OutputDim ¶
func (c *LayerPoolMax) OutputDim() (int, int)
func (*LayerPoolMax) ParamsUpdate ¶
func (c *LayerPoolMax) ParamsUpdate(alpha float64)
type LayerRecordShadow ¶
type LayerRecordShadow struct { LayerShadow // contains filtered or unexported fields }
func NewLayerRecordShadow ¶
func NewLayerRecordShadow(shadow Layer, record_m, record_n int, action ActionOfLayerRecordShadow) *LayerRecordShadow
func (*LayerRecordShadow) BackwardProp ¶
func (c *LayerRecordShadow) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
func (*LayerRecordShadow) Current ¶
func (c *LayerRecordShadow) Current() *SimpleMatrix
func (*LayerRecordShadow) ForwardProp ¶
func (c *LayerRecordShadow) ForwardProp(input *SimpleMatrix) *SimpleMatrix
func (*LayerRecordShadow) MoveNext ¶
func (c *LayerRecordShadow) MoveNext() *LayerRecordShadow
func (*LayerRecordShadow) MovePrev ¶
func (c *LayerRecordShadow) MovePrev() *LayerRecordShadow
func (*LayerRecordShadow) Next ¶
func (c *LayerRecordShadow) Next() *SimpleMatrix
func (*LayerRecordShadow) ParamsUpdate ¶
func (c *LayerRecordShadow) ParamsUpdate(alpha float64)
func (*LayerRecordShadow) Prev ¶
func (c *LayerRecordShadow) Prev() *SimpleMatrix
func (*LayerRecordShadow) SwitchContext ¶
func (c *LayerRecordShadow) SwitchContext(i int) *LayerRecordShadow
type LayerSelfishShadow ¶
func NewLayerSelfishShadow ¶
func NewLayerSelfishShadow(shadow Layer) *LayerSelfishShadow
func (*LayerSelfishShadow) Activate ¶
func (c *LayerSelfishShadow) Activate(copy_input, copy_output, copy_grad bool) *LayerSelfishShadow
func (*LayerSelfishShadow) BackwardProp ¶
func (c *LayerSelfishShadow) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
func (*LayerSelfishShadow) CorrectDelta ¶
func (c *LayerSelfishShadow) CorrectDelta(delta []*SimpleMatrix, offset int)
func (*LayerSelfishShadow) Delta ¶
func (c *LayerSelfishShadow) Delta() []*SimpleMatrix
func (*LayerSelfishShadow) DeltaN ¶
func (c *LayerSelfishShadow) DeltaN() int
func (*LayerSelfishShadow) ForwardProp ¶
func (c *LayerSelfishShadow) ForwardProp(input *SimpleMatrix) *SimpleMatrix
func (*LayerSelfishShadow) InputDim ¶
func (c *LayerSelfishShadow) InputDim() (int, int)
func (*LayerSelfishShadow) OutputDim ¶
func (c *LayerSelfishShadow) OutputDim() (int, int)
func (*LayerSelfishShadow) ParamsUpdate ¶
func (c *LayerSelfishShadow) ParamsUpdate(alpha float64)
type LayerShadow ¶
func NewLayerShadow ¶
func NewLayerShadow(shadow Layer) *LayerShadow
func (*LayerShadow) BackwardProp ¶
func (c *LayerShadow) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
func (*LayerShadow) CorrectDelta ¶
func (c *LayerShadow) CorrectDelta(delta []*SimpleMatrix, offset int)
func (*LayerShadow) Delta ¶
func (c *LayerShadow) Delta() []*SimpleMatrix
func (*LayerShadow) DeltaN ¶
func (c *LayerShadow) DeltaN() int
func (*LayerShadow) ForwardProp ¶
func (c *LayerShadow) ForwardProp(input *SimpleMatrix) *SimpleMatrix
func (*LayerShadow) InputDim ¶
func (c *LayerShadow) InputDim() (int, int)
func (*LayerShadow) LastGrad ¶
func (c *LayerShadow) LastGrad() *SimpleMatrix
func (*LayerShadow) LastInput ¶
func (c *LayerShadow) LastInput() *SimpleMatrix
func (*LayerShadow) LastOutput ¶
func (c *LayerShadow) LastOutput() *SimpleMatrix
func (*LayerShadow) LoadLastInput ¶
func (c *LayerShadow) LoadLastInput(input *SimpleMatrix)
func (*LayerShadow) LoadLastOutput ¶
func (c *LayerShadow) LoadLastOutput(output *SimpleMatrix)
func (*LayerShadow) OutputDim ¶
func (c *LayerShadow) OutputDim() (int, int)
func (*LayerShadow) ParamsUpdate ¶
func (c *LayerShadow) ParamsUpdate(alpha float64)
type LossMixin ¶
type LossMixin interface { // Calculate mean loss given output and predicted output. Loss(output, output_pred *SimpleMatrix) *SimpleMatrix }
type NeuralChain ¶
type NeuralChain struct { LayerBase NeuralNetwork Layers []Layer InputM, InputN int }
func NewNeuralChain ¶
func NewNeuralChain() *NeuralChain
func (*NeuralChain) AddLayer ¶
func (n *NeuralChain) AddLayer(layer Layer) NeuralNetwork
func (*NeuralChain) BackwardProp ¶
func (c *NeuralChain) BackwardProp(output_grad *SimpleMatrix) *SimpleMatrix
func (*NeuralChain) CorrectDelta ¶
func (c *NeuralChain) CorrectDelta(delta []*SimpleMatrix, offset int)
func (*NeuralChain) CorrectLayerDelta ¶
func (c *NeuralChain) CorrectLayerDelta(delta []*SimpleMatrix, offset, layerIndex int)
func (*NeuralChain) DefineInputDim ¶
func (c *NeuralChain) DefineInputDim(m, n int) *NeuralChain
func (*NeuralChain) Delta ¶
func (c *NeuralChain) Delta() []*SimpleMatrix
func (*NeuralChain) DeltaN ¶
func (c *NeuralChain) DeltaN() int
func (*NeuralChain) Error ¶
func (n *NeuralChain) Error(predict, expect *SimpleMatrix) float64
func (*NeuralChain) Fit ¶
func (n *NeuralChain) Fit(input, expect *SimpleMatrix, alpha float64) NeuralNetwork
func (*NeuralChain) ForwardProp ¶
func (c *NeuralChain) ForwardProp(input *SimpleMatrix) *SimpleMatrix
func (*NeuralChain) InputDim ¶
func (c *NeuralChain) InputDim() (int, int)
func (*NeuralChain) Learn ¶
func (n *NeuralChain) Learn(predict *SimpleMatrix, expect *SimpleMatrix) NeuralNetwork
func (*NeuralChain) OutputDim ¶
func (c *NeuralChain) OutputDim() (int, int)
func (*NeuralChain) ParamsUpdate ¶
func (c *NeuralChain) ParamsUpdate(alpha float64)
func (*NeuralChain) Predict ¶
func (n *NeuralChain) Predict(input *SimpleMatrix) *SimpleMatrix
func (*NeuralChain) Update ¶
func (n *NeuralChain) Update(alpha float64) NeuralNetwork
type NeuralNetwork ¶
type NeuralNetwork interface { AddLayer(layer Layer) NeuralNetwork Fit(input, expect *SimpleMatrix, alpha float64) NeuralNetwork Predict(input *SimpleMatrix) *SimpleMatrix Learn(predict *SimpleMatrix, expect *SimpleMatrix) NeuralNetwork Update(alpha float64) NeuralNetwork }
type NeuralRecurrentChain ¶
type NeuralRecurrentChain struct {
NeuralChain
}
func NewNeuralRecurrentChain ¶
func NewNeuralRecurrentChain(input_m, input_n int) *NeuralRecurrentChain
func (*NeuralRecurrentChain) AddLayer ¶
func (n *NeuralRecurrentChain) AddLayer(layer Layer) NeuralNetwork
func (*NeuralRecurrentChain) AddRecurrentLayer ¶
func (n *NeuralRecurrentChain) AddRecurrentLayer(layer Layer, recurrence_type string) *NeuralRecurrentChain
func (*NeuralRecurrentChain) PredictRestart ¶
func (n *NeuralRecurrentChain) PredictRestart()
type NopActionOfLayerRecordShadow ¶
type NopActionOfLayerRecordShadow struct {
ActionOfLayerRecordShadow
}
func (*NopActionOfLayerRecordShadow) DeltaApply ¶
func (a *NopActionOfLayerRecordShadow) DeltaApply(c *LayerRecordShadow, alpha float64)
func (*NopActionOfLayerRecordShadow) DeltaUpdate ¶
func (a *NopActionOfLayerRecordShadow) DeltaUpdate(c *LayerRecordShadow)
func (*NopActionOfLayerRecordShadow) GradPlus ¶
func (a *NopActionOfLayerRecordShadow) GradPlus(c *LayerRecordShadow, grad *SimpleMatrix) *SimpleMatrix
func (*NopActionOfLayerRecordShadow) InputPlus ¶
func (a *NopActionOfLayerRecordShadow) InputPlus(c *LayerRecordShadow, input *SimpleMatrix) *SimpleMatrix
func (*NopActionOfLayerRecordShadow) Record ¶
func (a *NopActionOfLayerRecordShadow) Record(c *LayerRecordShadow)
func (*NopActionOfLayerRecordShadow) ResetRecord ¶
func (a *NopActionOfLayerRecordShadow) ResetRecord(c *LayerRecordShadow)
type RecordInputDelayUpdateOfLayerRecordShadow ¶
type RecordInputDelayUpdateOfLayerRecordShadow struct { RecordInputOfLayerRecordShadow Delta []*SimpleMatrix }
func (*RecordInputDelayUpdateOfLayerRecordShadow) DeltaApply ¶
func (a *RecordInputDelayUpdateOfLayerRecordShadow) DeltaApply(c *LayerRecordShadow, alpha float64)
func (*RecordInputDelayUpdateOfLayerRecordShadow) DeltaUpdate ¶
func (a *RecordInputDelayUpdateOfLayerRecordShadow) DeltaUpdate(c *LayerRecordShadow)
type RecordInputOfLayerRecordShadow ¶
type RecordInputOfLayerRecordShadow struct {
NopActionOfLayerRecordShadow
}
func (*RecordInputOfLayerRecordShadow) GradPlus ¶
func (a *RecordInputOfLayerRecordShadow) GradPlus(c *LayerRecordShadow, grad *SimpleMatrix) *SimpleMatrix
func (*RecordInputOfLayerRecordShadow) Record ¶
func (a *RecordInputOfLayerRecordShadow) Record(c *LayerRecordShadow)
type RecordOutputDelayUpdateOfLayerRecordShadow ¶
type RecordOutputDelayUpdateOfLayerRecordShadow struct { RecordOutputOfLayerRecordShadow Delta []*SimpleMatrix }
func (*RecordOutputDelayUpdateOfLayerRecordShadow) DeltaApply ¶
func (a *RecordOutputDelayUpdateOfLayerRecordShadow) DeltaApply(c *LayerRecordShadow, alpha float64)
func (*RecordOutputDelayUpdateOfLayerRecordShadow) DeltaUpdate ¶
func (a *RecordOutputDelayUpdateOfLayerRecordShadow) DeltaUpdate(c *LayerRecordShadow)
type RecordOutputOfLayerRecordShadow ¶
type RecordOutputOfLayerRecordShadow struct {
NopActionOfLayerRecordShadow
}
func (*RecordOutputOfLayerRecordShadow) GradPlus ¶
func (a *RecordOutputOfLayerRecordShadow) GradPlus(c *LayerRecordShadow, grad *SimpleMatrix) *SimpleMatrix
func (*RecordOutputOfLayerRecordShadow) Record ¶
func (a *RecordOutputOfLayerRecordShadow) Record(c *LayerRecordShadow)
type RecurrenceOfLayerRecordShadow ¶
type RecurrenceOfLayerRecordShadow struct { RecordOutputOfLayerRecordShadow H, DeltaH *SimpleMatrix // contains filtered or unexported fields }
func (*RecurrenceOfLayerRecordShadow) DeltaApply ¶
func (a *RecurrenceOfLayerRecordShadow) DeltaApply(c *LayerRecordShadow, alpha float64)
func (*RecurrenceOfLayerRecordShadow) DeltaUpdate ¶
func (a *RecurrenceOfLayerRecordShadow) DeltaUpdate(c *LayerRecordShadow)
func (*RecurrenceOfLayerRecordShadow) GradPlus ¶
func (a *RecurrenceOfLayerRecordShadow) GradPlus(c *LayerRecordShadow, grad *SimpleMatrix) *SimpleMatrix
func (*RecurrenceOfLayerRecordShadow) Init ¶
func (a *RecurrenceOfLayerRecordShadow) Init(record_m, record_n int) *RecurrenceOfLayerRecordShadow
func (*RecurrenceOfLayerRecordShadow) InitFill ¶
func (a *RecurrenceOfLayerRecordShadow) InitFill(h *SimpleMatrix) *RecurrenceOfLayerRecordShadow
func (*RecurrenceOfLayerRecordShadow) InputPlus ¶
func (a *RecurrenceOfLayerRecordShadow) InputPlus(c *LayerRecordShadow, input *SimpleMatrix) *SimpleMatrix
func (*RecurrenceOfLayerRecordShadow) ResetRecord ¶
func (a *RecurrenceOfLayerRecordShadow) ResetRecord(c *LayerRecordShadow)
type SimpleMatrix ¶
func NewSimpleMatrix ¶
func NewSimpleMatrix(m, n int) *SimpleMatrix
func (*SimpleMatrix) Add ¶
func (X *SimpleMatrix) Add(Y *SimpleMatrix, a1, a2 float64) *SimpleMatrix
func (*SimpleMatrix) Clone ¶
func (X *SimpleMatrix) Clone() *SimpleMatrix
func (*SimpleMatrix) Col ¶
func (X *SimpleMatrix) Col(x int) *SimpleMatrix
func (*SimpleMatrix) ConnectBottom ¶
func (X *SimpleMatrix) ConnectBottom(Y *SimpleMatrix) *SimpleMatrix
func (*SimpleMatrix) ConnectLeft ¶
func (X *SimpleMatrix) ConnectLeft(Y *SimpleMatrix) *SimpleMatrix
func (*SimpleMatrix) ConnectRight ¶
func (X *SimpleMatrix) ConnectRight(Y *SimpleMatrix) *SimpleMatrix
func (*SimpleMatrix) ConnectTop ¶
func (X *SimpleMatrix) ConnectTop(Y *SimpleMatrix) *SimpleMatrix
func (*SimpleMatrix) Convolute ¶
func (X *SimpleMatrix) Convolute(Kernel *SimpleMatrix) *SimpleMatrix
func (*SimpleMatrix) Dot ¶
func (X *SimpleMatrix) Dot(Y *SimpleMatrix) *SimpleMatrix
func (*SimpleMatrix) Dump ¶
func (X *SimpleMatrix) Dump()
func (*SimpleMatrix) EltMax ¶
func (X *SimpleMatrix) EltMax() float64
func (*SimpleMatrix) EltMin ¶
func (X *SimpleMatrix) EltMin() float64
func (*SimpleMatrix) EltMul ¶
func (X *SimpleMatrix) EltMul(Y *SimpleMatrix) *SimpleMatrix
func (*SimpleMatrix) EltSum ¶
func (X *SimpleMatrix) EltSum() float64
func (*SimpleMatrix) Fill ¶
func (X *SimpleMatrix) Fill(x float64) *SimpleMatrix
func (*SimpleMatrix) FillElt ¶
func (X *SimpleMatrix) FillElt(x []float64) *SimpleMatrix
func (*SimpleMatrix) FillGuassian ¶
func (X *SimpleMatrix) FillGuassian(mu, std float64) *SimpleMatrix
func (*SimpleMatrix) FillRandom ¶
func (X *SimpleMatrix) FillRandom(a, b float64) *SimpleMatrix
func (*SimpleMatrix) FillWindow ¶
func (X *SimpleMatrix) FillWindow(y, x int, Y *SimpleMatrix) *SimpleMatrix
func (*SimpleMatrix) FillWindowMap ¶
func (X *SimpleMatrix) FillWindowMap( y, x int, Y *SimpleMatrix, f func(float64, float64) float64, ) *SimpleMatrix
func (*SimpleMatrix) Map ¶
func (X *SimpleMatrix) Map(f func(float64) float64) *SimpleMatrix
func (*SimpleMatrix) MapWindow ¶
func (X *SimpleMatrix) MapWindow(m, n, h, w int, f func(float64) float64) *SimpleMatrix
func (*SimpleMatrix) MirrorM ¶
func (X *SimpleMatrix) MirrorM() *SimpleMatrix
func (*SimpleMatrix) MirrorN ¶
func (X *SimpleMatrix) MirrorN() *SimpleMatrix
func (*SimpleMatrix) Pool ¶
func (X *SimpleMatrix) Pool( pool_m, pool_n, stride_m, stride_n int, f func(float64, float64) float64, init float64, ) *SimpleMatrix
func (*SimpleMatrix) ReduceWindow ¶
func (*SimpleMatrix) Reshape ¶
func (X *SimpleMatrix) Reshape(m, n int) *SimpleMatrix
func (*SimpleMatrix) Row ¶
func (X *SimpleMatrix) Row(x int) *SimpleMatrix
func (*SimpleMatrix) SacleWindow ¶
func (X *SimpleMatrix) SacleWindow(m, n, h, w int, a float64) *SimpleMatrix
func (*SimpleMatrix) Scale ¶
func (X *SimpleMatrix) Scale(a float64) *SimpleMatrix
func (*SimpleMatrix) Softmax ¶
func (X *SimpleMatrix) Softmax() *SimpleMatrix
func (*SimpleMatrix) T ¶
func (X *SimpleMatrix) T() *SimpleMatrix
func (*SimpleMatrix) Window ¶
func (X *SimpleMatrix) Window(y, x, h, w int) *SimpleMatrix
Source Files ¶
Click to show internal directories.
Click to hide internal directories.