Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
I'm having problems with a piecewise constant parameter optimization. I'm getting
MINPACK: improper input parameters Still digging the code to find out what the problem is. Would you share an example of a succesfull optimization with PiecewiseConstantParameter class? Thank you, Javit |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
javit <[hidden email]> writes: > MINPACK: improper input parameters This suggests you are using the Levenberg-Marquardt algorithm. Did you try using the ConjugateGradient, it might give you a more verbose error message? Best, Bojan -- Bojan Nikolic || http://www.bnikolic.co.uk ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Bojan,
Thank you for the reply. I tried the simplex class and it worked. I believe it is the Levenberg-Marquardt causing the trouble. I will try the ConjugateGradient class, too. Javit
... [show rest of quote]
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
In reply to this post by javit
Hi Javit
could you please send (or post) the code that causes the problem. The Levenberg-Marquardt algorithm should (in theory;-) work for PiecewiseConstantParameter. cheers Klaus ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Klaus,
At my first read, I believed that LM algorithm should work too. I got the code running with ConjugateGradient method. It took me sometime to figure out what is wrong. It turns out that after the optimized parameters are called, I call the model class once more to get the node values. And at that call, since the values are optimal, the root finders return an error complaining that the root is not bracketed. Both optimal f values have the same sign. Therefore, in Solver1d.hpp, I believe that one should check the accuracy of the starting points (is f(x_1) - f(x_2) close to zero and is f(x_1) close to zero?) before checking the signs of the f(x_1) and f(x_2). The current checks are: Is f(x_1) = 0 ? Is f(x_2) = 0 ? Rather than this, it should be: Is Abs( f(x_1) ) < accuracy? Is Abs( f(x_2) ) < accuracy? If yes, then return the x as the root before starting to check the signs of f values. For the LM algorithm, I still don't know why it is not working. I would bet that it is the number of optimization variables causing the error. My code is currently messy. I cannot send it as it is. I will let you know when all is done. Thank you for your help, Javit
... [show rest of quote]
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
I think I know where the problem might be located: in your cost function
Array values(Array x) is the dimension of the returned array smaller than the dimension of x? e.g. you are optimizing with respect to 3 parameters, but returning a 2 dimensional array. lmdif checks for m < n if this is true, your error code (*info=0) is returned * m is a positive integer input variable set to the number * of functions. * * n is a positive integer input variable set to the number * of variables. n must not exceed m. I think the objective in the MINPACK algo is to avoid an ill posed problem. Can you check please? Otherwise we'll find something else :) 2009/9/3 javit <[hidden email]>
... [show rest of quote] ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Dima,
Thank you for your reply. I can't check it right away. It's our heavy season this time of the year. Things got slowed down now. Previously, I checked the LM code. The code exits with info = 0. That's why I was suspicious of the number of optimization variables. Javit
... [show rest of quote]
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
In reply to this post by javit
On Thu, 2009-09-03 at 05:19 -0700, javit wrote:
> It took me sometime to figure out what is wrong. It turns out that after the > optimized parameters are called, I call the model class once more to get the > node values. I'm not sure I follow. Is this in your code or in the library? What class or function does the calls? It sounds strange that the solver is called again after the parameters have been optimized... > Therefore, in Solver1d.hpp, I believe that one should check the accuracy of > the starting points (is f(x_1) - f(x_2) close to zero and is f(x_1) close to > zero?) before checking the signs of the f(x_1) and f(x_2). > > The current checks are: > > Is f(x_1) = 0 ? > Is f(x_2) = 0 ? > > Rather than this, it should be: > Is Abs( f(x_1) ) < accuracy? > Is Abs( f(x_2) ) < accuracy? The problem here is that the interface of Solver1D is not clearly defined. Depending on the particular solver, the required accuracy might be on the y axis (i.e., give me an x for which abs(f(x)) < accuracy) or on the x axis (give me an x for which abs(x-x0) < accuracy, where x0 is the real root.) The above only works with y accuracy. Luigi -- Every solution breeds new problems. -- unknown ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Disable Popup Ads | Edit this page |