-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
TypeError: in method 'EndCriteria_call_', argument 3 of type 'Size &' #1956
Comments
Thanks for posting! It might take a while before we look at your issue, so don't worry if there seems to be no feedback. We'll get to it. |
I'm kind of guessing since I don't know how you initialized the various variables, but
might work. The |
Thank you very much for your good advices. May be you a right. But I have read very interesting article about this topic: “The Levenberg-Marquardt Method and its Implementation in Python” submitted by Marius Kaltenbach (Konstanzer Online-Publikations-System (KOPS) URL: http://nbn-resolving.de/urn:nbn:de:bsz:352-2-1ofyba49ud2jr5). So far I have no complaints about this argument ‘statState’. |
You don't have to call the method 'EndCriteria__call__'. That method is internal and shouldn't be exposed to Python. You have already passed the input parameters to the |
Thank you very much for your good advices. I corrected the error in the script, so it shouldn't happen again. Apparently there is another problem with the code. |
Hard to say what's wrong without seeing the rest of the code. Can you post a script that we can run to reproduce the problem? |
But you're a busy man. Therefore, if I’m already in a difficult situation, I should not waste your time on unnecessary thoughts or waiting for a miracle, which simply can not be. For a long time I assumed that this error was due purely to my own personal bumbling, and not a problem with the method. Anyway I'm trying to answer the question, to articulate my ask. |
No problem, it took all of 5 minutes once I had code to run. The code below runs the calibration. You were nearly there. The needed changes were:
|
It's amazing incredible! Excellent attention, you have solved the problem. I’m grateful for your help and support. Also, I am grateful for the good fortune to learn at you, to communicate with the great minds, I'm not afraid of this word, experts in programming and machine learning. May be interest to the independent decision of a problem is the stimulus, driving force of process of knowledge. I hope this information proves helpful to someone in the future. Regards! |
I cordially salute the participants of the QuantLib conference. As for me one of the most important tools, in particular in calibration procedures, is an optimizer of a function. For example, my typical problem is: find a model parameter set such that some cost function is minimized. The available optimizers in QuantLib are Levenberg Marquardt methods. To setup up an optimizer, I need to define the end criteria which lead to a successful optimization. They are summarized in the EndCriteria class whose constructor os EndCriteria (StationaryStateIterations). I wrote a small piece of code to сonsider the Vasicek model for standard Brownian motion. With a little bit of bad advice, I find myself facing a much bigger challenge.
model.calibrate(swaptions, optimization_method, end_criteria(10000, 100, 1e-6, 1e-8, 1e-8, 1.0e-8, 1.0e-8, 1.0e-8))
File "pandas1/lib/python3.10/site-packages/QuantLib/QuantLib.py", line 7508, in call__return QuantLib.EndCriteria___call(self, iteration, statState, positiveOptimization, fold, normgold, fnew, normgnewx, ecType)
TypeError: in method 'EndCriteria___call_', argument 3 of type 'Size &'
I am new in this field, could you please guide me about this error. And how should I write this argument ‘statState’ of type 'Size &'?
The text was updated successfully, but these errors were encountered: