| auto syten::GradientOpt::gradient_descent_linesearch | ( | X | x, |
| FunctionEval | func, | ||
| GradientEval | grad, | ||
| LinesearchEval | lin, | ||
| RandomStep | rand, | ||
| Terminator | terminate, | ||
| Index | num_steps = 100, |
||
| Index | ls_num_steps = 50, |
||
| SRDef | ls_lower = 0, |
||
| SRDef | ls_upper = 1 |
||
| ) |
Attempt at a gradient descent with linesearch.
Works very badly.
| X | domain type |
| FunctionEval | type of the function evaluation function, taking an X |
| GradientEval | type of the gradient evaluation function, taking a result of the function and its X |
| LinesearchEval | type of the linesearch evaluation function, taking a step size a, the current iteration point x and the gradient g and returning the value of f(x-a*g) and ‘f’(x-a*g)` (wrt a). |
| RandomStep | type of the random stepper to be enacted if nothing else works. Takes the step size (either 0 or NAN) point and the gradient. |
| Terminator | type of the termination condition, returning true if we should break out. Takes the step size, current function value and current gradient. |
| x | initial value |
| func | object returning f(x) when given x |
| grad | object returning f'(x) when given f(x) and x |
| lin | object returning f(x-a*g) and f'(x-a*g) (wrt a) when given a, x and g |
| rand | object returning an updated random x when given x and g |
| terminate | object returning true if, given a step size alpha, the current function value and the current gradient, we should terminate early. |
| num_steps | maximal number if outer steps to take |
| ls_num_steps | number of steps to be done during the linesearch |
| ls_lower | lower end of the line search |
| ls_upper | upper end of the line search |
References syten::isnan(), linesearch(), std::make_tuple(), and std::move().
Here is the call graph for this function: