Open erastogi opened 6 years ago
here is the code to replicate the issue: inp = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])
model = sklearn.ensemble.RandomForestClassifier().fit(inp, [1,1,0,0]) predictions, bias, contributions = ti.predict(model, inp)
Error occurs at line 63 in treeinterpreter.py in _predict_tree(model, X, joint_contribution)
This is because not all model.estimator return tree values as 2D.
This bug is fixed in the latest version, try to update.
here is the code to replicate the issue: inp = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])
model = sklearn.ensemble.RandomForestClassifier().fit(inp, [1,1,0,0]) predictions, bias, contributions = ti.predict(model, inp)
Error occurs at line 63 in treeinterpreter.py in _predict_tree(model, X, joint_contribution)
This is because not all model.estimator return tree values as 2D.