Re: [R] optimized value worse than starting Value
On Wed, Sep 8, 2010 at 6:26 PM, Michael Bernsteiner dethl...@hotmail.com wrote: @Barry: Yes it is the Rosenbrock Function. I'm trying out some thing I found here: http://math.fullerton.edu/mathews/n2003/PowellMethodMod.html @Ravi: Thanks for your help. I will have a closer look at the BB package. Am I right, that the optimx package is ofline atm? (Windows) It looks like the Windows build of optimx failed the R CMD check when running the examples: http://www.r-project.org/nosvn/R.check/r-devel-windows-ix86+x86_64/optimx-00check.html Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] optimized value worse than starting Value
Yes, Barry, we are aware of this issue. It is caused by printing to console from FORTRAN in one of the optimization codes, ucminf. If we set trace=FALSE in optimx, this problem goes away. Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Barry Rowlingson b.rowling...@lancaster.ac.uk Date: Thursday, September 9, 2010 4:13 am Subject: Re: [R] optimized value worse than starting Value To: Michael Bernsteiner dethl...@hotmail.com Cc: rvarad...@jhmi.edu, r-help@r-project.org On Wed, Sep 8, 2010 at 6:26 PM, Michael Bernsteiner dethl...@hotmail.com wrote: @Barry: Yes it is the Rosenbrock Function. I'm trying out some thing I found here: @Ravi: Thanks for your help. I will have a closer look at the BB package. Am I right, that the optimx package is ofline atm? (Windows) It looks like the Windows build of optimx failed the R CMD check when running the examples: Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] optimized value worse than starting Value
Barry Rowlingson b.rowlingson at lancaster.ac.uk writes: On Wed, Sep 8, 2010 at 1:35 PM, Michael Bernsteiner dethlef1 at hotmail.com wrote: Dear all, I'm optimizing a relatively simple function. Using optimize the optimized parameter value is worse than the starting. why? I would like to stress here that finding a global minimum is not as much sorcery as this thread seems to suggest. A widely accepted procedure to provably identify a global minimum goes roughly as follows (see Chapt. 4 in [1]): - Make sure the global minimum does not lie 'infinitely' for out. - Provide estimations for the derivatives/gradients. - Define a grid fine enough to capture or exclude minima. - Search grid cells coming into consideration and compare. This can be applied to two- and higher-dimensional problems, but of course may require enormous efforts. In science and engineering applications it is at times necessary to really execute this approach. Hans Werner [1] F. Bornemann et al., The SIAM 100-Digit Challenge, 2004, pp. 79. In fact, a slightly finer grid search will succeed in locating the proper minimum; several teams used such a search together with estimates based on the partial derivatives of f to show that the search was fine enough to guarantee capture of the answer. This looks familiar. Is this some 1-d version of the Rosenbrock Banana Function? http://en.wikipedia.org/wiki/Rosenbrock_function It's designed to be hard to find the minimum. In the real world one would hope that things would not have such a pathological behaviour. Numerical optimisations are best done using as many methods as possible - see optimise, nlm, optim, nlminb and the whole shelf of library books devoted to it. Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] optimized value worse than starting Value
Dear all, I'm optimizing a relatively simple function. Using optimize the optimized parameter value is worse than the starting. why? f-function(delta,P,U){ minimiz-P+delta*U x-minimiz[1] y-minimiz[2] z-100*(y-x^2)^2+(1-x)^2 return(z) } result-optimize(f, interval=c(-10, 10), P=c(0.99,1.01), U=c(1,0)) result Output: result-optimize(f, interval=c(-10, 10), P=c(0.99,1.01), U=c(1,0)) result $minimum [1] -1.990015 $objective [1] 4.01 Function Value at Starting Point with free parameter=0: f(0,c(0.99,1.01),c(1,0)) [1] 0.089501 It seems as if optimize doesn't check the whole interval. result-optimize(f, interval=c(-1, 10), P=c(0.99,1.01), U=c(1,0)) result $minimum [1] 0.01497394 $objective [1] 2.481504e-05 Changing the lower interval value leads to the result I am looking for. How do I find this result when I have no idea where the optimal values lies and want to look in an interval that is as wide as possible? any ideas? Michael [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] optimized value worse than starting Value
Dieter Menne had already told you what the problem is. You have 2 local minima. One is a global minimum. Depending on your starting interval, the optimizer can converge to one of the two local minima. If you want to be reasonably sure that you always find the global minimum, you either have to use problem-specific knowledge or try a sufficiently large number of starting values and pick the best solution. Here is one approach: require(BB) p0 - matrix(rnorm(20), 20, 1) # 20 random starting values ans - multiStart(par=p0, fn=f, action=optimize, P=c(0.99,1.01), U=c(1,0)) ans Hope this helps, Ravi. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Michael Bernsteiner Sent: Wednesday, September 08, 2010 8:36 AM To: r-help@r-project.org Subject: [R] optimized value worse than starting Value Dear all, I'm optimizing a relatively simple function. Using optimize the optimized parameter value is worse than the starting. why? f-function(delta,P,U){ minimiz-P+delta*U x-minimiz[1] y-minimiz[2] z-100*(y-x^2)^2+(1-x)^2 return(z) } result-optimize(f, interval=c(-10, 10), P=c(0.99,1.01), U=c(1,0)) result Output: result-optimize(f, interval=c(-10, 10), P=c(0.99,1.01), U=c(1,0)) result $minimum [1] -1.990015 $objective [1] 4.01 Function Value at Starting Point with free parameter=0: f(0,c(0.99,1.01),c(1,0)) [1] 0.089501 It seems as if optimize doesn't check the whole interval. result-optimize(f, interval=c(-1, 10), P=c(0.99,1.01), U=c(1,0)) result $minimum [1] 0.01497394 $objective [1] 2.481504e-05 Changing the lower interval value leads to the result I am looking for. How do I find this result when I have no idea where the optimal values lies and want to look in an interval that is as wide as possible? any ideas? Michael [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] optimized value worse than starting Value
On Wed, Sep 8, 2010 at 1:35 PM, Michael Bernsteiner dethl...@hotmail.com wrote: Dear all, I'm optimizing a relatively simple function. Using optimize the optimized parameter value is worse than the starting. why? f-function(delta,P,U){ minimiz-P+delta*U x-minimiz[1] y-minimiz[2] z-100*(y-x^2)^2+(1-x)^2 return(z) } This looks familiar. Is this some 1-d version of the Rosenbrock Banana Function? http://en.wikipedia.org/wiki/Rosenbrock_function It's designed to be hard to find the minimum. In the real world one would hope that things would not have such a pathological behaviour. Numerical optimisations are best done using as many methods as possible - see optimise, nlm, optim, nlminb and the whole shelf of library books devoted to it. Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] optimized value worse than starting Value
Numerical optimisations are best done using as many methods as possible See the optimx package: http://cran.r-project.org/web/packages/optimx/index.html Ravi. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Barry Rowlingson Sent: Wednesday, September 08, 2010 10:27 AM To: Michael Bernsteiner Cc: r-help@r-project.org Subject: Re: [R] optimized value worse than starting Value On Wed, Sep 8, 2010 at 1:35 PM, Michael Bernsteiner dethl...@hotmail.com wrote: Dear all, I'm optimizing a relatively simple function. Using optimize the optimized parameter value is worse than the starting. why? f-function(delta,P,U){ minimiz-P+delta*U x-minimiz[1] y-minimiz[2] z-100*(y-x^2)^2+(1-x)^2 return(z) } This looks familiar. Is this some 1-d version of the Rosenbrock Banana Function? http://en.wikipedia.org/wiki/Rosenbrock_function It's designed to be hard to find the minimum. In the real world one would hope that things would not have such a pathological behaviour. Numerical optimisations are best done using as many methods as possible - see optimise, nlm, optim, nlminb and the whole shelf of library books devoted to it. Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] optimized value worse than starting Value
@Barry: Yes it is the Rosenbrock Function. I'm trying out some thing I found here: http://math.fullerton.edu/mathews/n2003/PowellMethodMod.html @Ravi: Thanks for your help. I will have a closer look at the BB package. Am I right, that the optimx package is ofline atm? (Windows) Michael From: rvarad...@jhmi.edu To: b.rowling...@lancaster.ac.uk; dethl...@hotmail.com CC: r-help@r-project.org Subject: RE: [R] optimized value worse than starting Value Date: Wed, 8 Sep 2010 12:09:31 -0400 Numerical optimisations are best done using as many methods as possible See the optimx package: http://cran.r-project.org/web/packages/optimx/index.html Ravi. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Barry Rowlingson Sent: Wednesday, September 08, 2010 10:27 AM To: Michael Bernsteiner Cc: r-help@r-project.org Subject: Re: [R] optimized value worse than starting Value On Wed, Sep 8, 2010 at 1:35 PM, Michael Bernsteiner dethl...@hotmail.com wrote: Dear all, I'm optimizing a relatively simple function. Using optimize the optimized parameter value is worse than the starting. why? f-function(delta,P,U){ minimiz-P+delta*U x-minimiz[1] y-minimiz[2] z-100*(y-x^2)^2+(1-x)^2 return(z) } This looks familiar. Is this some 1-d version of the Rosenbrock Banana Function? http://en.wikipedia.org/wiki/Rosenbrock_function It's designed to be hard to find the minimum. In the real world one would hope that things would not have such a pathological behaviour. Numerical optimisations are best done using as many methods as possible - see optimise, nlm, optim, nlminb and the whole shelf of library books devoted to it. Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.