[move to stan-dev]
If we can do optimization faster than R's builtins,
that's fantastic.
I was not counting data read times because I was
starting with the data in R and Jiqiang wrote a tight
integration there.
Of course, reading 30MB would be faster in a format other
than R dump. It's an intrinsically slow format and the code's
hardly optimized.
And yes, I have a nice new core i7 Macbook Pro which took
3s in R, with no data read time.
- Bob
On 5/21/13 6:50 PM, Marcus Brubaker wrote:
> Ok, I just did a quick test of BFGS using the model and data generation scripts Bob sent. This is with K = 160 and N =
> 10,000
>
> Marcus-Brubakers-MacBook-Pro:stan mbrubake$ time ./logistic --data=logisitic.data --point_estimate_bfgs --init=0 --refresh=5
> STAN OPTIMIZATION COMMAND
> data = logisitic.data
> init = 0
> output = samples.csv
> save_warmup = 0
> epsilon = -1
> seed = 3496505751 (randomly generated)
> initial log joint probability = -6931.47
> Iter log prob ||dx|| ||grad|| alpha alpha0 # evals Notes
> 1 -1781.82 3.99246 514.407 0.001 0.001 2
> 5 -1148.86 1.55728 151.342 1 1 6
> 10 -1030.79 0.0556683 6.50517 1 1 11
> 15 -1030.66 0.00178793 0.189879 1 1 16
> 20 -1030.66 0.000108344 0.00874977 1 1 21
> 25 -1030.66 1.7213e-06 0.000248864 1 1 26
> 30 -1030.66 8.76987e-08 3.63224e-06 1 1 71
> 32 -1030.66 1.09407e-08 2.35202e-06 0.0001565 0.001 148 LS failed, BFGS reset;
> Optimization terminated with code -1
>
> real 0m13.129s
> user 0m12.912s
> sys 0m0.188s
>
> So, in short, 13s. Now, a few caveats:
>
> 1) The BFGS implementation is currently bad at detecting convergence. If it was better at this, that would probably be 10s.
> 2) Somewhere around 7 or 8 seconds is spent before the first iteration is ever run. I suspect that most of this is
> caused by reading in the data from the R dump format.
> 3) This timing is on a different machine than Bob's, but I suspect my 3-4yr old macbook pro is probably slower than
> whatever Bob was running on.
>
> If we assumed that 1&2 could be resolved, the time would be more like 3 or 4 seconds which is basically the same as the
> glm() reported on what is a presumably faster machine.
>
> Cheers,
> Marcus
>
> P.S. Here is the result of point_estimate_newton on my machine:
>
> Marcus-Brubakers-MacBook-Pro:stan mbrubake$ time ./logistic --data=logisitic.data --point_estimate_newton --init=0
> STAN OPTIMIZATION COMMAND
> data = logisitic.data
> init = 0
> output = samples.csv
> save_warmup = 0
> seed = 3496875472 (randomly generated)
> initial log joint probability = -6931.47
> Iteration 1. Log joint probability = -3207.55. Improved by 3723.92.
> Iteration 2. Log joint probability = -2079.52. Improved by 1128.03.
> Iteration 3. Log joint probability = -1482.83. Improved by 596.698.
> Iteration 4. Log joint probability = -1179.95. Improved by 302.88.
> Iteration 5. Log joint probability = -1059. Improved by 120.947.
> Iteration 6. Log joint probability = -1032.31. Improved by 26.6863.
> Iteration 7. Log joint probability = -1030.66. Improved by 1.64927.
> Iteration 8. Log joint probability = -1030.66. Improved by 0.00773384.
> Iteration 9. Log joint probability = -1030.66. Improved by 1.87733e-07.
>
> real 3m26.021s
> user 3m20.686s
> sys 0m0.657s
>
>
>
>
> On Tue, May 21, 2013 at 6:24 PM, Matt Hoffman <
mdho...@cs.princeton.edu <mailto:
mdho...@cs.princeton.edu>> wrote:
>
> Wow, I didn't realize that the Eigen benchmark results were that compelling.
>
> Three more questions:
> 1. Do we have the relevant optimization flags enabled to let Eigen
> take advantage of things like SSE?
> 2. Are we letting Eigen parallelize matrix operations?
> 3. Do we have specialized adjoint computations for matrix ops yet? 1
> and 2 won't do much good until we do.
>
> Matt
>
> On Tue, May 21, 2013 at 3:10 PM, Bob Carpenter <
ca...@alias-i.com <mailto:
ca...@alias-i.com>> wrote:
> >
> >
> > On 5/21/13 6:03 PM, Matt Hoffman wrote:
> >>
> >> Was that using Newton's method or BFGS?
> >
> >
> > I don't know, which is why I said it's whatever RStan uses!
> > I don't see any explanation in the RStan doc, which only refers
> > to "Stan's optimization method".
> >
> >
> >> The convergence speed (in
> >> iterations) looks more like Newton (a.k.a. iteratively reweighted
> >> least squares). That Newton implementation is getting the Hessian in a
> >> pretty naive way, which for LR can be much more heavily optimized.
> >
> >
> > That would certainly cause a problem with 160 params!
> >
> >
> >> Are we linking against a BLAS? I've been meaning to bring that up as a
> >> possible area for optimization. I would assume that glm is using some
> >> kind of optimized BLAS, which makes a big, big difference when your
> >> primary computational operation is matrix multiplication and
> >> inversion.
> >
> >
> > No. We're just using Eigen. Here's a link to an older benchmark
> > of Eigen vs. various BLAS implementations (they claim to be faster than
> > all of the free ones):
> >
> >
http://eigen.tuxfamily.org/index.php?title=Benchmark
> >
> >
> > - Bob
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "stan users mailing list" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to
stan-users+...@googlegroups.com <mailto:
stan-users%2Bunsu...@googlegroups.com>.
> --
> You received this message because you are subscribed to the Google Groups "stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
>
stan-users+...@googlegroups.com <mailto:
stan-users%2Bunsu...@googlegroups.com>.
> --
> You received this message because you are subscribed to the Google Groups "stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
stan-users+...@googlegroups.com.