causalml icon indicating copy to clipboard operation
causalml copied to clipboard

when the example jupyter notebook run, it raises an error

Open tjefferson opened this issue 1 year ago • 0 comments

Describe the bug A clear and concise description of what the bug is. notebook:https://github.com/uber/causalml/blob/master/docs/examples/meta_learners_with_synthetic_data.ipynb

error:


TypeError Traceback (most recent call last) Cell In[22], line 2 1 #distribution plot for signle simulation of Training ----> 2 distr_plot_single_sim(train_preds, kind='kde', linewidth=2, bw_method=0.5, 3 drop_learners=['S Learner (LR)',' S Learner (XGB)'])

File ~/miniconda3/lib/python3.11/site-packages/causalml/dataset/synthetic.py:229, in distr_plot_single_sim(synthetic_preds, kind, drop_learners, bins, histtype, alpha, linewidth, bw_method) 227 # deleted generated data and assign actual value 228 del preds_for_plot[KEY_GENERATED_DATA] --> 229 global_lower = np.percentile(np.hstack(preds_for_plot.values()), 1) 230 global_upper = np.percentile(np.hstack(preds_for_plot.values()), 99) 231 learners = list(preds_for_plot.keys())

File ~/miniconda3/lib/python3.11/site-packages/numpy/core/shape_base.py:216, in _vhstack_dispatcher(tup, dtype, casting) 215 def _vhstack_dispatcher(tup, *, dtype=None, casting=None): --> 216 return _arrays_for_stack_dispatcher(tup)

File ~/miniconda3/lib/python3.11/site-packages/numpy/core/shape_base.py:209, in _arrays_for_stack_dispatcher(arrays) 207 def _arrays_for_stack_dispatcher(arrays): 208 if not hasattr(arrays, "getitem"): --> 209 raise TypeError('arrays to stack must be passed as a "sequence" type ' 210 'such as list or tuple.') 212 return tuple(arrays)

TypeError: arrays to stack must be passed as a "sequence" type such as list or tuple.

To Reproduce Steps to reproduce the behavior:

runs the notebook

Expected behavior A clear and concise description of what you expected to happen.

no error, and show the plot

Screenshots If applicable, add screenshots to help explain your problem. image

Environment (please complete the following information):

  • OS: macOS
  • Python Version: 3.11.7
    • Versions of Major Dependencies (pandas, scikit-learn, cython): [e.g. pandas==0.25, scikit-learn==0.22, cython==0.28]

Additional context Add any other context about the problem here.

tjefferson avatar Mar 05 '24 04:03 tjefferson