How to load a scikit model nested inside a folder in python

Viewed 13

I'm trying to load a pre-trained model in python using pickle but I'm having a hard time accessing the files as they are inside a folder, in the current directory. I want to access com, dri and tax.

enter image description here

I don't want to put the models in the root directory. Is there's a way to access them in this location?

1 Answers

You should specify the path from your module, since your files are in the models directory, you should have :

driver = pickle.load(open('models/dri', 'rb'))
comm = pickle.load(open('models/com', 'rb'))
tax = pickle.load(open('models/tax', 'rb'))
Related