djcrw/generalising-structural-knowledge

run_tem.py errors

Closed this issue · 3 comments

Thanks for sharing your code! I'm trying to run it in a virtualenv (python3.6) and it looks like one of the files might be slightly out of date?

I'm running: python run_tem.py and when constructing default params there are a number of KeyError exceptions starting with:

Traceback (most recent call last):
  File "run_tem.py", line 21, in <module>
    pars = default_params()
  File "generalising-structural-knowledge/parameters.py", line 28, in default_params
    params['reward_value'] = params['n_states'][0]  # make same as predicting other sensory experiences
KeyError: 'n_states'

That error is fixed by shuffling line order around, but then there is another error:

Traceback (most recent call last):
  File "run_tem.py", line 21, in <module>
    pars = default_params()
  File "generalising-structural-knowledge/parameters.py", line 76, in default_params
    params['n_senses'] = [params['s_size']] * params['n_freq']
KeyError: 'n_freq'

I'm not familiar with the code, so it's not obvious how to fix these errors. Could you update the default_params function or point me in the right direction?

yifr commented

Hi Justin, I had the same issue - if you move the
params['n_senses'] = [params['s_size']] * params['n_freq'] line so it comes after params['n_freq'] = len(params['n_phases_all']) that should solve the problem.

After that change the model runs successfully for me.

yifr commented

One more error I want to add to the list:

From helper_functions.py I get the following error:

 File helper_functions.py", line 365, in combins_table
    table_top = scipy.special.comb(n, k)
AttributeError: module 'scipy' has no attribute 'special'

This can be fixed by adding an import statement from scipy import special and changing the two places where special is called (lines 353 and 366) to special.comb instead of scipy.special.comb.

djcrw commented

Sorry completely missed this - yes should all be fixed now!