hddm-devs / hddm

HDDM is a python module that implements Hierarchical Bayesian parameter estimation of Drift Diffusion Models (via PyMC).
http://ski.clps.brown.edu/hddm_docs/
Other
261 stars 117 forks source link

reduce() of empty sequence with no initial value #107

Open jasongong11 opened 1 year ago

jasongong11 commented 1 year ago

I recently installed the lasted version of HDDM (0.9.9).

I run the tutorial.

The code m = hddm.HDDM(data)

give the following error:

No model attribute --> setting up standard HDDM
Set model to ddm
/home/jasongong/anaconda3/envs/hddm_test/lib/python3.7/site-packages/hddm/models/base.py:1310: UserWarning:  
 Your include statement misses either the v, a or t parameters. 
Parameters not explicitly included will be set to the defaults, 
which you can find in the model_config dictionary!
  + "which you can find in the model_config dictionary!"
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_109359/1763651991.py in <module>
----> 1 m = hddm.HDDM(data)
      2 # find a good starting point which helps with the convergence.
      3 m.find_starting_values()
      4 # start drawing 2000 samples and discarding 20 as burn-in (usually you want to have a longer burn-in period)
      5 m.sample(2000, burn=20)

~/anaconda3/envs/hddm_test/lib/python3.7/site-packages/hddm/models/hddm_info.py in __init__(self, *args, **kwargs)
    156             self.model_config = kwargs.pop("model_config")
    157 
--> 158         super(HDDM, self).__init__(*args, **kwargs)
    159 
    160         # -------------------------------------------------------------------------------------

~/anaconda3/envs/hddm_test/lib/python3.7/site-packages/hddm/models/base.py in __init__(self, data, bias, include, wiener_params, p_outlier, **kwargs)
   1390         )
   1391 
-> 1392         super(HDDMBase, self).__init__(data, **kwargs)
   1393 
   1394     def __getstate__(self):

~/anaconda3/envs/hddm_test/lib/python3.7/site-packages/hddm/models/base.py in __init__(self, data, **kwargs)
     72 
     73         self.std_depends = kwargs.pop("std_depends", False)
---> 74         super(AccumulatorModel, self).__init__(data, **kwargs)
     75 
     76     def _create_an_average_model(self):

~/anaconda3/envs/hddm_test/lib/python3.7/site-packages/kabuki/hierarchical.py in __init__(self, data, is_group_model, depends_on, trace_subjs, plot_subjs, plot_var, group_only_nodes)
    384         self.db = None
    385 
--> 386         self._setup_model()
    387 
    388     def _setup_model(self):

~/anaconda3/envs/hddm_test/lib/python3.7/site-packages/kabuki/hierarchical.py in _setup_model(self)
    395 
    396         # constructs pymc nodes etc and connects them appropriately
--> 397         self.create_model()
    398 
    399     def __getstate__(self):

~/anaconda3/envs/hddm_test/lib/python3.7/site-packages/kabuki/hierarchical.py in create_model(self, max_retries)
    486 
    487         # Check whether all user specified column names (via depends_on) where used by the depends_on.
--> 488         assert set(flatten(list(self.depends.values()))).issubset(
    489             set(flatten(self.nodes_db.depends))
    490         ), "One of the column names specified via depends_on was not picked up. Check whether you specified the correct parameter value."

~/anaconda3/envs/hddm_test/lib/python3.7/site-packages/kabuki/utils.py in flatten(l)
     11 
     12 def flatten(l):
---> 13     return reduce(lambda x, y: list(x) + list(y), l)
     14 
     15 

TypeError: reduce() of empty sequence with no initial value

if you need additional information, please let me know.

I found the HDDMRegressor works fine.

Best, Jason