0

I inherited some code from a coworker who left my company, and I noticed that an email open predictor he wrote hasn't run in a few weeks. So, I tried to run it. It got to this line:

clf_predict = joblib.load(os.path.join(data_dir,'trained_random_forest.pkl'))

And the result was this:

File "/usr/local/lib/python2.7/distpackages/sklearn/externals/joblib/numpy_pickle.py", line 425, in load
obj = unpickler.load()
File "/usr/lib/python2.7/pickle.py", line 858, in load dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1133, in load_reduce
value = func(*args)
File "sklearn/tree/_tree.pyx", line 923, in sklearn.tree._tree.Splitter.__cinit__ (sklearn/tree/_tree.c:8329)
TypeError: __cinit__() takes exactly 5 positional arguments (4 given)

The syntax for the load looks right to me from what I've seen in the documentation. Therefore, my initial theory is that maybe scikit-learn was upgraded and can't read the current pickle file (which is a few months old at this point). However, I don't know for sure that it was upgraded, and I'm pretty new to working with sklearn, so I don't know if that would pose a problem. Appreciate any pointers you can give

jpavs
  • 648
  • 5
  • 17

1 Answers1

0

Assuming that it worked for your co-worker and your problem is due to an sklearn upgrade. The extra argument to the Splitter init was introduced in this commit. You could try loading the pkl file in an earlier version of sklearn and take it from there.

mwv
  • 4,221
  • 2
  • 19
  • 9