I am trying to use the sorted()
in python
and trying to find the interpretation
but I get this error.
ValueError: too many values to unpack (expected 2)
Here’s my code:
from treeinterpreter import treeinterpreter as ti
X = processed_data[0]
y = prediction
rf = pickle.load(open("original/PermutationModelNew.sav", "rb"))
prediction, bias, contributions = ti.predict(rf, X)
print("Bias (trainset mean)", bias[0])
c, feature = sorted(zip(contributions[0],X.columns))
X
is the test data and it looks like this:
Age DailyRate DistanceFromHome ... BusinessTravel_ OverTime_ Over18_
0 39 903 2 ... 2 1 1
[1 rows x 28 columns]
and y
looks like this:
[0]
Can someone please help me to fix this? I am using this Example
Source: Python Questions