Hi All,
I'm coming back to an old algo a year later that used ExtraTreesClassifiers. I'm experiencing bugs and it appears to be because .fit appears to be running asynchronously and my code was not meant for that. I put a try catch around it thinking maybe an error was occurring but that does not seem to be the case.
Does anyone know if this behavior has changed? I see nothing in sklearn docs.
Thanks,
Cole
Cole S
Nevermind :) Verified it works in other places, but the behavior is very weird… Still not sure what's happening.
Cole S
Here's my code. I added the try block to figure out what is happening. It will hit the .fit, then the finally block, but then it does not continue executing and instead jumps back to main.py and continues execution there.
Fred Painchaud
Hi Cole,
From what you are saying, fit throws an exception which is not caught by “except Exception as e:”. If Exception is really the base class for all exceptions, this is weird. But in theory, it is not from that example and the exception thrown inherits from something else - my memory is failing but maybe something like “SystemException”. I recall two main branches of exceptions in Python……
Fred
Cole S
Thanks Fred. This was a good excuse to get LEAN CLI setup and debug locally. I was able to see the exception (Invalid Type Promotion) and am now working my way through that. Thanks!
Cole S
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!