Guest User

traceback output

a guest
Feb 1st, 2023
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. ---------------------------------------------------------------------------
  2. AttributeError Traceback (most recent call last)
  3. AttributeError: 'Explanation' object has no attribute 'conjugate'
  4.  
  5. The above exception was the direct cause of the following exception:
  6.  
  7. TypeError Traceback (most recent call last)
  8. Cell In[9], line 7
  9. 1 #import shap
  10. 2
  11. 3 #explainer = shap.Explainer(model)
  12. 4 #shap_values = explainer(X_train)
  13. 5
  14. 6 # create a SHAP dependence plot for a specific feature
  15. ----> 7 shap.dependence_plot("iv_total", shap_values, X_train)
  16. 8 plt.show()
  17.  
  18. File ~/Research/Libraries/miniforge3/envs/workspace-ds/lib/python3.10/site-packages/shap/plots/_scatter.py:568, in dependence_legacy(ind, shap_values, features, feature_names, display_features, interaction_index, color, axis_color, cmap, dot_size, x_jitter, alpha, title, xmin, xmax, ax, show, ymin, ymax)
  19. 566 if not hasattr(ind, "__len__"):
  20. 567 if interaction_index == "auto":
  21. --> 568 interaction_index = approximate_interactions(ind, shap_values, features)[0]
  22. 569 interaction_index = convert_name(interaction_index, shap_values, feature_names)
  23. 570 categorical_interaction = False
  24.  
  25. File ~/Research/Libraries/miniforge3/envs/workspace-ds/lib/python3.10/site-packages/shap/utils/_general.py:143, in approximate_interactions(index, shap_values, X, feature_names)
  26. 141 if not (i == index or np.sum(np.abs(val_other)) < 1e-8):
  27. 142 for j in range(0, len(x), inc):
  28. --> 143 if np.std(val_other[j:j + inc]) > 0 and np.std(shap_ref[j:j + inc]) > 0:
  29. 144 v += abs(np.corrcoef(shap_ref[j:j + inc], val_other[j:j + inc])[0, 1])
  30. 145 val_v = v
  31.  
  32. File <__array_function__ internals>:5, in std(*args, **kwargs)
  33.  
  34. File ~/Research/Libraries/miniforge3/envs/workspace-ds/lib/python3.10/site-packages/numpy/core/fromnumeric.py:3581, in std(a, axis, dtype, out, ddof, keepdims, where)
  35. 3578 else:
  36. 3579 return std(axis=axis, dtype=dtype, out=out, ddof=ddof, **kwargs)
  37. -> 3581 return _methods._std(a, axis=axis, dtype=dtype, out=out, ddof=ddof,
  38. 3582 **kwargs)
  39.  
  40. File ~/Research/Libraries/miniforge3/envs/workspace-ds/lib/python3.10/site-packages/numpy/core/_methods.py:262, in _std(a, axis, dtype, out, ddof, keepdims, where)
  41. 260 def _std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False, *,
  42. 261 where=True):
  43. --> 262 ret = _var(a, axis=axis, dtype=dtype, out=out, ddof=ddof,
  44. 263 keepdims=keepdims, where=where)
  45. 265 if isinstance(ret, mu.ndarray):
  46. 266 ret = um.sqrt(ret, out=ret)
  47.  
  48. File ~/Research/Libraries/miniforge3/envs/workspace-ds/lib/python3.10/site-packages/numpy/core/_methods.py:242, in _var(a, axis, dtype, out, ddof, keepdims, where)
  49. 238 x = um.add(xv[..., 0], xv[..., 1], out=x.real).real
  50. 239 # Most general case; includes handling object arrays containing imaginary
  51. 240 # numbers and complex types with non-native byteorder
  52. 241 else:
  53. --> 242 x = um.multiply(x, um.conjugate(x), out=x).real
  54. 244 ret = umr_sum(x, axis, dtype, out, keepdims=keepdims, where=where)
  55. 246 # Compute degrees of freedom and make sure it is not negative.
  56.  
  57. TypeError: loop of ufunc does not support argument 0 of type Explanation which has no callable conjugate method
Advertisement
Add Comment
Please, Sign In to add comment