Skip to content
This repository was archived by the owner on Nov 23, 2018. It is now read-only.

Commit f2db24b

Browse files
committed
Clean up docs for GradientDescent
1 parent 2371855 commit f2db24b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

gradientdescent.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,27 @@ package optimize
66

77
import "github.com/gonum/floats"
88

9-
// GradientDescent is a Method that performs gradient-based optimization.
10-
// Gradient Descent performs successive steps along the direction of the
11-
// gradient. The Linesearcher specifies the kind of linesearch to be done, and
12-
// StepSizer determines the initial step size of each direction. If either
13-
// Linesearcher or StepSizer are nil, a reasonable value will be chosen.
9+
// GradientDescent implements the steepest descent optimization method that
10+
// performs successive steps along the direction of the negative gradient.
1411
type GradientDescent struct {
12+
// Linesearcher selects suitable steps along the descent direction.
13+
// If Linesearcher is nil, a reasonable default will be chosen.
1514
Linesearcher Linesearcher
16-
StepSizer StepSizer
15+
// StepSizer determines the initial step size along each direction.
16+
// If StepSizer is nil, a reasonable default will be chosen.
17+
StepSizer StepSizer
1718

1819
ls *LinesearchMethod
1920
}
2021

2122
func (g *GradientDescent) Init(loc *Location) (Operation, error) {
22-
if g.StepSizer == nil {
23-
g.StepSizer = &QuadraticStepSize{}
24-
}
2523
if g.Linesearcher == nil {
2624
g.Linesearcher = &Backtracking{}
2725
}
26+
if g.StepSizer == nil {
27+
g.StepSizer = &QuadraticStepSize{}
28+
}
29+
2830
if g.ls == nil {
2931
g.ls = &LinesearchMethod{}
3032
}

0 commit comments

Comments
 (0)