No module named sklearn.linear_model.logistic when I do dataiku.Model(model_name).get_predictor()
I am trying to get the predictor name of a model, so that I can further get the coefficients of LR model, but I am getting the following error-
"No module named sklearn.linear_model.logistic" when I do dataiku.Model(model_name).get_predictor()
Best Answer
-
Miguel Angel Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 118 Dataiker
Hi,
It seems a package is missing in your code env. You can check that on Administration > Code Envs > <select the notebook's code env> > Currently installed packages
Do you find 'scikit-learn' among them? If so, what version is it?, it may need to be updated.
If not, could you please make sure the code env used for this notebook has installed the 'Visual Machine Learning (scikit-learn, XGBoost,LightGBM)' package set?
Answers
-
Thanks for your response! It helped. The sklearn version in Visual ML recipe was older then the one I was using in the python recipe.
-
@MiguelangelC
I am still facing the same issue even after having the updated version of scikit-learn(version: 0.24.2) in my code envs installed packages. I also have installed the 'Visual Machine Learning (scikit-learn, XGBoost,LightGBM)' package set in my code env. Could you please help me in resolving this issue ? -
No module named sklearn.linear_model.logistic when I do model_1.get_predictor() where I am trying to load the already saved model.
Can anyone please help me here to resolve this issue ?
-
Sergey Dataiker, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS Core Concepts Posts: 365 Dataiker
Hi @vaishnavi
logistic appeared in sklearn since 0.22 version:
https://github.com/scikit-learn/scikit-learn/blob/0.22.X/sklearn/linear_model/_logistic.py
Please make sure that you are using the correct code env and either stop the current kernel/ kill the session or "Force reload" the notebook to make sure you are loading the updated code env.
-
Hi @sergeyd
I did check the python code env and made sure that am using scikit-learn == 0.24.2 version. I then force reloaded the python notebook as well. Still facing the same issue. -
Sergey Dataiker, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS Core Concepts Posts: 365 Dataiker
I cannot reproduce the issue with scikit-learn>0.22 in the code env.
-
Hi @sergeyd
I have attached few images related to the python env I am using and the packages version for better understanding of the issue. -
@sergeyd
After updating the python version to 3.9, I am getting the below error when I executemodel_1 = dataiku.Model(<model_id>)
pred_1 = model_1.get_predictor()TypeError: an integer is required (got type bytes)