I have a trained decision tree model file music-recommender.joblib
. When I am using Jupyter notebook, I am able to load this trained model successfully and able to do prediction. But the same code I used in pycharm and it is showing error.
In Jupyter Notebook
As you can see, it is predicting correctly based on the trained model
In PyCharm
Does anyone knows why is it this way?
You call the joblib.load()
method but do not assign the output to any variable. And in the next step you are trying to use the model
variable which is not defined anywhere above and hence the error.
You need to do:
model = joblib.load(...)