Exemple #1
0
    run_exp(rank)

#dump('parser_model_'+str(NDRAWS)+'_iterations', trace)

with parser_model:
    trace = load('../../data/parser_model_' + str(NDRAWS) + '_iterations')

pm.diagnostics.gelman_rubin(trace)
traceplot(trace)
plt.savefig('../../figures/parser_' + str(NDRAWS) + '_trace.eps')
plt.savefig('../../figures/parser_' + str(NDRAWS) + '_trace.png')
plt.savefig('../../figures/parser_' + str(NDRAWS) + '_trace.pdf')
#plt.show()

mu_rt = pd.DataFrame(trace['mu_rt'])
yerr_rt = [(mu_rt.mean()-mu_rt.quantile(0.025)),\
        (mu_rt.quantile(0.975)-mu_rt.mean())]


def generate_parser_model_figure():
    fig, ax1 = plt.subplots(ncols=1, nrows=1)
    fig.set_size_inches(5.5, 3.5)
    # plot 1: RTs
    ax1.errorbar(RT, mu_rt.mean(), yerr=yerr_rt, marker='o', linestyle='')
    ax1.plot(np.linspace(300, 500, 10), np.linspace(300, 500, 10),\
             color='red', linestyle=':')
    #ax1.set_title('Fan model: Observed vs. predicted RTs')
    ax1.set_title('')
    ax1.set_xlabel('Observed RTs (ms)')
    ax1.set_ylabel('Predicted RTs (ms)')
    ax1.grid(b=True, which='minor', color='w', linewidth=1.0)
Exemple #2
0
#dump('../data/lex_dec_pyactr_no_imaginal', trace)

with lex_decision_with_bayes:
    trace = load('../data/lex_dec_pyactr_no_imaginal')

pm.diagnostics.gelman_rubin(trace)
pm.traceplot(trace)
plt.savefig('../figures/lex_dec_model_pyactr_no_imaginal_trace.eps')
plt.savefig('../figures/lex_dec_model_pyactr_no_imaginal_trace.png')
plt.savefig('../figures/lex_dec_model_pyactr_no_imaginal_trace.pdf')
#plt.show()

mu_rt = pd.DataFrame(trace['mu_rt']) * 1000
RT = RT * 1000
yerr_rt = [(mu_rt.mean() - mu_rt.quantile(0.025)),
           (mu_rt.quantile(0.975) - mu_rt.mean())]

mu_prob = pd.DataFrame(trace['mu_prob'])
yerr_prob = [(mu_prob.mean() - mu_prob.quantile(0.025)),
             (mu_prob.quantile(0.975) - mu_prob.mean())]


def generate_lex_dec_pyactr_no_imaginal_figure():
    fig, (ax1, ax2) = plt.subplots(ncols=1, nrows=2)
    fig.set_size_inches(5.5, 5.5)
    # plot 1: RTs
    ax1.errorbar(RT, mu_rt.mean(), yerr=yerr_rt, marker='o', linestyle='')
    ax1.plot(np.linspace(500, 800, 10),
             np.linspace(500, 800, 10),
             color='red',
    # accuracy likelihood
    odds_reciprocal = tt.exp(-(activation_from_time - threshold)/noise)
    mu_prob = Deterministic('mu_prob', 1/(1 + odds_reciprocal))
    prob_observed = Normal('prob_observed', mu=mu_prob, sd=0.01,\
                           observed=ACCURACY)
    # we start the sampling
    #step = Metropolis()
    #db = SQLite('lex_dec_pyactr_chain_no_imaginal.sqlite')
    #trace = sample(draws=60000, trace=db, njobs=1, step=step, init='auto')

with lex_decision_with_bayes:
    trace = load('./data/lex_dec_pyactr_chain_no_imaginal.sqlite')
    trace = trace[10500:]

mu_rt = pd.DataFrame(trace['mu_rt'])
yerr_rt = [(mu_rt.mean()-mu_rt.quantile(0.025)),\
           (mu_rt.quantile(0.975)-mu_rt.mean())]

mu_prob = pd.DataFrame(trace['mu_prob'])
yerr_prob = [(mu_prob.mean()-mu_prob.quantile(0.025)),\
             (mu_prob.quantile(0.975)-mu_prob.mean())]

def generate_lex_dec_pyactr_no_imaginal_figure():
    fig, (ax1, ax2) = plt.subplots(ncols=1, nrows=2)
    fig.set_size_inches(6.0, 8.5)
    # plot 1: RTs
    ax1.errorbar(RT, mu_rt.mean(), yerr=yerr_rt, marker='o', linestyle='')
    ax1.plot(np.linspace(500, 800, 10), np.linspace(500, 800, 10),\
             color='red', linestyle=':')
    ax1.set_title('Lex. dec. model (pyactr, no imaginal): RTs')
    ax1.set_xlabel('Observed RTs (ms)')