Hi, I've been using QuantConnect for the past couple years and am very pleased with its functionality. I trained an Xgboost model locally and am having difficulty using it in QuantConnect. I was able to upload it into QuantConnect per the attached instructions, but when I try to use functions from the model (e.g., predict_proba) they give errors. Would anyone know what the problem is? I attached a backtest with the problem lines commented out. I've tried to Google/Stack Overflow the errors but I can't find any posts with similar issues, so I believe it's specific to QuantConnect. In the error messages I can see the model is being properly called a CalibratedClassifierCV object so it seems to at least be partially working. I am able to run my model locally with the exact lines of code not working within QuantConnect. Thanks.
Louis Szeto
Hi Dahui
Sorry but we can't reproduce your issue😢. I've tried with the sklearn example model with our documented base64 encode/decode method. Everything works fine. Here is how I did it locally:
I've also tested the exact code in your attached backtest, but replaced with my testing dropbox file's link. It also worked.
Actually, your dropbox link inside the snippet failed to recover the model when decoding locally either. Would you mind also providing the code on how do you encode and output the base64 string for further assistance? That would be the part most likely breaking things.
Best
Louis
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Dahui
Thanks a lot for the help Louis. Below is the code I use for encoding and outputting the base64 string:
Â
I am actually able to decode and use the model locally, directly downloading the file on the Dropbox link. I am also able to decode/use an example uncalibrated model into QuantConnect and use it successfully. So potentially I suppose I could just upload the uncalibrated version of the model as well as the data used to calibrate the model, then calibrate the model on QuantConnect directly (so long as using the calibration package on QuantConnect doesn't pose an issue). I'm using Python 3.8 if that makes a difference.
Â
Dahui
I just tried calibrating the model directly within QuantConnect with some dummy data and it seemed to work. So I suppose uploading the calibration data and recalibrating could be a potential workaround although I would much prefer to just upload the calibrated model directly.
Dahui
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!