Also, you could speed this up by compiling your cost and gradient
function.
On Sat, 15 Dec 2012 04:22:18 +0000, Michael Maul wrote:
> LBGS worked on the first go. Well after I fixed some problems in
> lapack and blas bindings and compiler/fortran (which are up on
> github).
>
> ; lbfgs
> ; (cputime (repeat 100 (lbfgs theta (lambda (t) (cost X y t))
> ; (lambda (gx t) (arraycopy (gradient X y t) gx) ()) 1e6
> params) ))
> ; = 1.46
> ; Compared with fminuc in octave
> ; options = optimset(GradObj, on, MaxIter, 400);
> ; tic();for c=1:100 fminunc(@(t)(costFunction(t, X, y)),
> initial_theta, options); endfor, toc()
> ; Elapsed time is 5.5109 seconds.
> (lbfgs theta (lambda (t) (cost X y t))
> (lambda (gx t) (arraycopy (gradient X y t) gx) ()) 1e6
> params)
> =[d 25.1637 0.2062 0.2015]
>
> Compared to fminuc lbfgs converged with only 25 calls to gradient
> where as fminuc made 75 calls to converge.
