New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize: Pass the problem dimension to getDefaultMethod() and use it there #664
Comments
I was thinking about using the dimension to decide whether BFGS or L-BFGS should be returned. What would be a suitable borderline value? |
Somewhere between 10 and 10000? If the Hessian is basically stationary, and the problem is "small", then BFGS is much preferred. Once BFGS starts to take up a significant amount of the update time (due to the matrix multiplications), then LBFGS is preferred. In theory, if the hessian varies significantly, LBFGS is better because it can adapt to the changing hessian better. In practice, neural networks have a highly non-stationary Hessian, and I have not noticed much difference between the two. A reasonable plan may be to see where the computational time crossover is between BFGS and LBFGS. We still have some optimizations to make in BFGS (using srk2 and dsymv) which should have significant speedups. |
Between 10 and 10000, nice :-) OK, let's wait until BFGS is optimized and then run some benchmarks. |
Given that the range is the scope of "int", I think I narrowed it down quite a bit. |
Has BFGS' use of symmetric matrices been already optimized? Running a small comparison between BFGS and LBFGS gives this:
Objective function is |
Is that with cblas or native? The BFGS code has been optimized as far as it is concerned, though some of the routines are slower than they could be in native. I'd guess the right number is somewhere in the 10-30 range, as beyond that the memory requirements go up significantly (and it doesn't seem like speed is much different at the small scales) |
That was with native. With OpenBLAS the number are like this:
I hope that I did it right because the numbers are almost the same (ok, slightly lower with OpenBLAS). I think that it would be useful if blas/README.md included a simple example on how to use it and how to switch between various implementations. What I did: package main
import (
"github.com/gonum/blas/blas64"
"github.com/gonum/blas/cgo"
)
func init() {
blas64.Use(cgo.Implementation{})
}
func main() {...} That's correct, isn't it? |
So what about 20? |
Yes, that is correct. |
No description provided.
The text was updated successfully, but these errors were encountered: