Documentation ¶
Overview ¶
Package gd provides gradient descent implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Converger ¶ added in v0.2.0
Converger is the interface that wraps the basic Converge method.
func NewConverger ¶ added in v0.2.0
NewConverger returns a new converger. If unsupported ConvergenceType is passed, an error is returned.
type ConvergerFunc ¶ added in v0.2.0
ConvergerFunc is an adapter to allow the use of plain functions as convergers.
type CostFunc ¶
CostFunc is a function template for cost function used in gradient descent algorithm.
type GradientDescent ¶ added in v0.2.0
type GradientDescent struct {
// contains filtered or unexported fields
}
GradientDescent holds the hyphothesis and cost functions needed by gradient descent algorithm.
func New ¶ added in v0.2.0
func New(h Hyphothesis, c CostFunc) GradientDescent
New creates new gradient descent.
type Hyphothesis ¶
Hyphothesis is a function template for a hyphothesis function used in gradient descent algorithm.
type Stepper ¶ added in v0.2.0
type Stepper interface { // TakeStep takes single step towards cost function minimum. TakeStep() error // CurrentCoefficients returns current coefficients calculated by stepper. CurrentCoefficients() []float64 // X returns design matrix used in calculations. X() [][]float64 // Y returns target vector used in calculations. Y() []float64 }
A Stepper wraps logic around taking steps (calculating new coefficients' values).
func NewStepper ¶ added in v0.2.0
func NewStepper(gdv options.GradientDescentVariant, h Hyphothesis, x [][]float64, y []float64, lr float64) (Stepper, error)