Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models fail to generate output statistics #95

Open
x-tabdeveloping opened this issue Dec 22, 2022 · 0 comments
Open

Models fail to generate output statistics #95

x-tabdeveloping opened this issue Dec 22, 2022 · 0 comments

Comments

@x-tabdeveloping
Copy link

Preparation

I installed hddm in a blank conda environment with Python 3.7 as recommended in the installation guide.
I followed the exact instructions specified in the repo's readme.

Code

The most minimal example where I managed to reproduce the error was training a simple HDDM model on my training data without any regression or depends_on arguments (But I have to mention that I encountered the same error trying to use HDDMRegressor and HDDMnnRegressor too).

import hddm
import pandas as pd

# This is a dataframe containing:
#   - subj_idx: str - subject ids
#   - rt: float - Reaction times in seconds
#   - response: float - 0.0 on incorrect responses, 1.0 on correct responses. 

dat = pd.read_csv("<filename>.csv")

model = hddm.HDDM(dat)
model.find_starting_values()
model.sample(1000, burn=1000)

Expected behaviour

The posterior is sampled without issue and output statistics are correctly calculated.

Actual behaviour

Sampling runs, but output statistics cannot be generated.
output:

/home/au689890/anaconda3/envs/hddm/lib/python3.7/site-packages/scipy/optimize/optimize.py:2215: RuntimeWarning: invalid value encountered in double_scalars
  tmp2 = (x - v) * (fx - fw)
 [-----------------100%-----------------] 1001 of 1000 complete in 80.5 sec
Could not generate output statistics for t
Could not generate output statistics for t_subj.<subject id>
...
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-4c77a0dec535> in <module>
      1 # %%
      2 ddm.find_starting_values()
----> 3 ddm.sample(1000, burn=1000)

~/anaconda3/envs/hddm/lib/python3.7/site-packages/kabuki/hierarchical.py in sample(self, *args, **kwargs)
    661         self.sampled = True
    662 
--> 663         self.gen_stats()
    664         return self.mc
    665 

~/anaconda3/envs/hddm/lib/python3.7/site-packages/kabuki/hierarchical.py in gen_stats(self, fname, print_hidden, **kwargs)
    739         """
    740 
--> 741         self.append_stats_to_nodes_db()
    742 
    743         sliced_db = self.nodes_db.copy()

~/anaconda3/envs/hddm/lib/python3.7/site-packages/kabuki/hierarchical.py in append_stats_to_nodes_db(self, *args, **kwargs)
    791             if self.nodes_db.loc[name, 'hidden']:
    792                 continue
--> 793             self.nodes_db.loc[name, 'mean']   = i_stats['mean']
    794             self.nodes_db.loc[name, 'std']    = i_stats['standard deviation']
    795             self.nodes_db.loc[name, '2.5q']   = i_stats['quantiles'][2.5]

TypeError: 'NoneType' object is not subscriptable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant