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

Installation/running basics problem #108

Closed luzuzek closed 10 months ago

luzuzek commented 10 months ago

Hello there,

after having a bunch of issues trying to install the last version of HDDM, I finally got it by doing this,

Apparently, everything is ready but when I try to do something super simple from the tutorial, like generate data with:

import hddm

model = 'angle' n_subjects = 1 n_samples_by_subject = 500

data, full_parameter_dict = hddm.simulators.hddm_dataset_generators.simulator_h_c(n_subjects = n_subjects, n_samples_by_subject = n_samples_by_subject, model = model, p_outlier = 0.00, conditions = None, depends_on = None, regression_models = None, regression_covariates = None, group_only_regressors = False, group_only = None, fixed_at_default = None)

I get


TypeError Traceback (most recent call last) Cell In[3], line 5 2 n_subjects = 1 3 n_samples_by_subject = 500 ----> 5 data, full_parameter_dict = hddm.simulators.hddm_dataset_generators.simulator_h_c(n_subjects = n_subjects, 6 n_samples_by_subject = n_samples_by_subject, 7 model = model, 8 p_outlier = 0.00, 9 conditions = None, 10 depends_on = None, 11 regression_models = None, 12 regression_covariates = None, 13 group_only_regressors = False, 14 group_only = None, 15 fixed_at_default = None)

File ~/anaconda3/envs/HDDM098/lib/python3.9/site-packages/hddm/simulators/hddm_dataset_generators.py:1417, in simulator_h_c(data, n_subjects, n_trials_per_subject, model, conditions, depends_on, regression_models, regression_covariates, group_only_regressors, group_only, fixed_at_default, p_outlier, outlier_max_t, **kwargs) 1398 group_level_param_dict = make_group_level_params( 1399 data=data, 1400 conditions_df=conditions_df, (...) 1413 covariate_range=meta_params["covariaterange"], 1414 ) 1416 if data is None: -> 1417 data, full_parameter_dict = make_single_sub_cond_df_gen( 1418 conditions_df=conditions_df, 1419 group_only=group_only, 1420 depends_on=depends_on, 1421 model=model, 1422 fixed_at_default=fixed_at_default, 1423 remainder=remainder, 1424 regression_models=regression_models, 1425 regression_covariates=regression_covariates, 1426 group_only_regressors=group_only_regressors, 1427 group_level_parameter_dict=group_level_param_dict, 1428 n_trials_per_subject=n_trials_per_subject, 1429 n_subjects=nsubjects, 1430 ) 1431 else: 1432 data, full_parameter_dict = make_single_sub_cond_df_from_gt( 1433 data=data, 1434 conditions_df=conditions_df, (...) 1443 group_level_parameter_dict=group_level_param_dict, 1444 )

File ~/anaconda3/envs/HDDM098/lib/python3.9/site-packages/hddm/simulators/hddm_dataset_generators.py:863, in simulator_h_c..make_single_sub_cond_df_gen(conditions_df, depends_on, regression_models, regression_covariates, group_only_regressors, group_only, fixed_at_default, remainder, model, group_level_parameter_dict, n_subjects, n_trials_per_subject) 858 parameters = full_data[model_config[model]["params"]] 860 # Run the actual simulations 861 # print(parameters) --> 863 sim_data = simulator( 864 theta=parameters.values, 865 model=model, 866 n_samples=1, 867 delta_t=0.001, 868 max_t=20, 869 no_noise=False, 870 bin_dim=None, 871 bin_pointwise=False, 872 ) 874 # Post-processing 875 full_data["rt"] = sim_data[0].astype(np.float64)

File ~/anaconda3/envs/HDDM098/lib/python3.9/site-packages/hddm/simulators/basic_simulator.py:31, in simulator(kwargs) 6 def simulator(kwargs): 7 """Basic data simulator for the models included in HDDM. 8 9 :Arguments: (...) 28 29 """ ---> 31 data_tmp = ssms.basic_simulators.simulator(**kwargs) 32 return (data_tmp["rts"], data_tmp["choices"], data_tmp["metadata"])

TypeError: 'module' object is not callable

Does anyone know something about this? Thanks!

hcp4715 commented 10 months ago

Hi, @luzuzek,

installing HDDM is difficult, we have created a docker image for HDDM 0.9.8: https://hub.docker.com/r/hcp4715/hddm/tags. Please let us know if you have any questions when using that docker image.

I just tested your code in docker, it works:

image
luzuzek commented 10 months ago

omg, this is great! Thanks!!