diff --git a/ntm.go b/ntm.go index acee036..45100af 100644 --- a/ntm.go +++ b/ntm.go @@ -283,6 +283,9 @@ type SGDMomentum struct { PrevD []float64 } +// NewSDGMomentun creates a new instance of a stochastic gradient descent with momentum object with the +// Controller object passed as an argument and a new slice as the PrevD with the length of the controllers +// Weights Values func NewSGDMomentum(c Controller) *SGDMomentum { s := SGDMomentum{ C: c, @@ -312,6 +315,7 @@ type RMSProp struct { D []float64 } +// NewRMSProp creates a new instance of the rmsprop algorithm based on the controller given as an argument func NewRMSProp(c Controller) *RMSProp { r := RMSProp{ C: c, diff --git a/unit.go b/unit.go index 77aee5d..947523a 100644 --- a/unit.go +++ b/unit.go @@ -10,6 +10,7 @@ type Unit struct { Grad float64 // gradient at node } +// String prints the value and gradient at a node in a neural network func (u Unit) String() string { return fmt.Sprintf("{%.3g %.3g}", u.Val, u.Grad) }