for n in range(args.N): print("Iteration {0}".format(n)) # Create data if args.behave == 'learn': trials, acc, p, prng = behave.learn( n_cond, args.n_trials, loc=prng.normal(3, .3), prng=prng ) elif args.behave == 'random': trials, acc, p, prng = behave.random( n_cond, args.n_trials, prng=prng ) else: raise ValueError('--behave not understood') df, rlpars = reinforce.rescorla_wagner(trials, acc, p, prng=prng) # Convolve with HRF df = convolve_hrf(df, dg(), asbold) # Orth select regressors to_orth = [['box', bold] for bold in asbold if bold != 'box'] for orth in to_orth: df[orth[1]+'_o'] = orthogonalize(df, orth)[orth[1]] # Do the regressions n_results = {} for model_name, model, test, hypoth in zip(*model_configs): for bold_name in asbold: l = df.shape[0] noi, prng = white(l, prng=prng)
loc=prng.normal(3, .3), prng=prng ) elif args.behave == 'random': trials, acc, p, prng = behave.random( n_cond, args.n_trials, prng=prng ) else: raise ValueError('--behave not understood') # There are two alphas loops. The first # creates the BOLD. The second creates # the predictors. for alpha_bold in alphas: # Create all bold options df_bold, _ = reinforce.rescorla_wagner( trials, acc, p, alpha=alpha_bold, prng=prng ) # Iter options for bold_name in asbold: l = df_bold.shape[0] noi, prng = white(l, prng=prng) df_bold['bold'] = create_bold( [df_bold[bold_name].values], dg(), noi ) # Create predictor for alpha_pred in alphas: df_pred, _ = reinforce.rescorla_wagner( trials, acc, p,
dfs = [] for n in range(args.N): if args.behave == 'learn': trial, acc, p, prng = behave.learn( args.n_cond, args.n_trials, loc=prng.normal(3, .3), prng=prng ) elif args.behave == 'random': trial, acc, p, prng = behave.random( args.n_cond, args.n_trials, prng=prng ) else: raise ValueError('--behave not understood') df, rlpars = reinforce.rescorla_wagner( trial, acc, p, alpha=args.alpha, prng=prng ) del df['rand'] l = trial.shape[0] df['count'] = np.repeat(n, l) df['index'] = np.arange(l, dtype=np.int) dfs.append(df) df = pd.concat(dfs, axis=0) if args.convolve: tocon = ['box', 'acc', 'p', 'rpe', 'value'] condf = convolve_hrf(df, dg(), tocon) for con in tocon: df[con] = condf[con]
args.n_trials, loc=prng.normal(3, .3), prng=prng) elif args.behave == 'random': trials, acc, p, prng = behave.random(n_cond, args.n_trials, prng=prng) else: raise ValueError('--behave not understood') # There are two alphas loops. The first # creates the BOLD. The second creates # the predictors. for alpha_bold in alphas: # Create all bold options df_bold, _ = reinforce.rescorla_wagner(trials, acc, p, alpha=alpha_bold, prng=prng) # Iter options for bold_name in asbold: l = df_bold.shape[0] noi, prng = white(l, prng=prng) df_bold['bold'] = create_bold([df_bold[bold_name].values], dg(), noi) # Create predictor for alpha_pred in alphas: df_pred, _ = reinforce.rescorla_wagner(trials, acc,
for n in range(args.N): print("Iteration {0}".format(n)) # Create data if args.behave == 'learn': trials, acc, p, prng = behave.learn( n_cond, args.n_trials, loc=prng.normal(3, .3), prng=prng ) elif args.behave == 'random': trials, acc, p, prng = behave.random( n_cond, args.n_trials, prng=prng ) else: raise ValueError('--behave not understood') df, rlpars = reinforce.rescorla_wagner(trials, acc, p, prng=prng) # Convolve with HRF df = convolve_hrf(df, dg(), asbold) # Orth select regressors to_orth = [['box', too] for too in asbold if too != 'box'] for orth in to_orth: df[orth[1]+'_o'] = orthogonalize(df, orth)[orth[1]] # Do the regressions n_results = {} for model_name, model, test, hypoth in zip(*model_configs): for bold_name in asbold: l = df.shape[0] noi, prng = white(l, prng=prng)