i have trained a model and joblib saved it into a .joblib file.
but I am unable to retrieve the stored object.
any advice on this?
thanks in advance!
trained on py3.8 and sklearn==1.2.2.QUANTCONNECT COMMUNITY
i have trained a model and joblib saved it into a .joblib file.
but I am unable to retrieve the stored object.
any advice on this?
thanks in advance!
trained on py3.8 and sklearn==1.2.2.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.
Alex mindustry
additionally, the joblib version is 1.3.2
Mia Alissi
Sure, I can guide you on how to retrieve a stored model using joblib in QuantConnect. Here are the steps:
ContainsKey
method with the model key. This method returns a boolean that represents if themodel_key
is in the Object Store.model_key
, you can proceed to get the file path of the stored model. Call theGetFilePath
method with the key.load
method with the file path.Please replace
model_key
with the actual key you used when saving the model. If the Object Store does not contain themodel_key
, you need to save the model using themodel_key
before you proceed.Here are the sources for your reference:
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.
Mia Alissi
The joblib version shouldn't affect the process of loading the model from the Object Store in QuantConnect. The steps to load the model remain the same regardless of the joblib version. Here they are again for your reference:
model_key
, get the file path of the stored model:Please replace
model_key
with the actual key you used when saving the model. If the Object Store does not contain themodel_key
, you need to save the model using themodel_key
before you proceed.If you're still having trouble, it might be due to compatibility issues between the joblib version used to save the model and the one used to load it. In that case, you might need to retrain and save your model using the same joblib version.
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.
Alex mindustry
just for reference, joblib load works on other python objects
Mia Alissi
It's good to know that joblib load is working for other Python objects. This suggests that your joblib installation and basic functionality are working correctly.
If you're having trouble specifically with loading sklearn models, it could be due to a compatibility issue between the sklearn version used to train and save the model and the one used to load it.
As a troubleshooting step, you could try retraining and saving your model with the same sklearn and joblib versions that you're using to load the model.
If the issue persists, it might be helpful to check the specific error message you're getting when trying to load the sklearn model. This could provide more insight into what might be going wrong.
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.
Alex mindustry
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!