Beispiel #1
0
#%%

# import necessary packages
import numpy as np # for numeric calculations
import pandas as pd
import func as f
import Agents as ag
agent_list = [ag.RLWM_noneFree(),ag.RLWM_allFree(),ag.RLWM_noise(),ag.RLWM_modulation(), ag.RLWM_actionSoftmax()]
numMod, numBlocks = len(agent_list), len(agent_list[0].Sub)
ModOrder = iter(range(numMod))
AICs, BICs, Mods = np.zeros((numBlocks, numMod)), np.zeros((numBlocks, numMod)), np.empty(numMod, dtype="object")
AICs_te, BICs_te = np.zeros((numBlocks, numMod)), np.zeros((numBlocks, numMod))

#%%

for i in agent_list:
    Order = next(ModOrder)
    agent = agent_list[Order]
    ModFit = np.load('../ModelFit/ModFit'+agent.name+'.npz',allow_pickle=True) # loads your saved array into variable a.
    te_ModFit = np.load('../Testing_ModelFit/Testing_ModelFit' + agent.name + '.npz', allow_pickle=True)
    f.ParamBar(agent.name,agent.pname, ModFit['Params'], ModFit['Ks'])
    AICs[:, Order], BICs[:, Order], Mods[Order] = ModFit['AICs'], ModFit['BICs'], ModFit['agtName']
    AICs_te[:, Order], BICs_te[:, Order] = te_ModFit['AICs'], te_ModFit['BICs']

#%%
Mods = ['noneFree', 'allFree', 'noise', 'modulation', 'action confusion']
f.ICBar(AICs, BICs, Mods, degree = 10)
Beispiel #2
0
import numpy as np  # for numeric calculations
import time  #calculate runtime
import Agents as ag
import func as f

#%%
agent_list = [
    ag.RLWM_noneFree(),
    ag.RLWM_allFree(),
    ag.RLWM_noise(),
    ag.RLWM_modulation(),
    ag.RLWM_actionSoftmax()
]
start_time = time.time()
AICs, BICs = f.modRec(agent_list, initSample=22, endSample=33)
print("--- %s seconds ---" % (time.time() - start_time))
np.savez('Model_Recovery', AICs=AICs,
         BICs=BICs)  # save the file as "outfile_name.npy"
#%%
# import necessary packages
import pandas as pd # for python data frame
import time#calculate runtime
import numpy as np # for numeric calculations
import Agents as ag
import func as f
m = np.load('../Model_Recovery/Model_Recovery_Sub1.npz') # save the file as "outfile_name.npy"
print(m['AICs'][:,:,1])
#%%
agent_list = [ag.RLWM_modulation(), ag.RLWM_actionSoftmax()]

#%%


'''
for agent in agent_list:
    agent.Sim_agent()
    data = f.actBias(pd.read_csv("../Learning_Validation/"+agent.name+".csv"))
    data.to_csv(r'../Action_Bias/'+agent.name+'.csv', index=False, header=True)

data = f.actBias(pd.read_csv("../Subject_Data/DT-RLWM-version4.csv"))
data.to_csv(r'../Action_Bias/DT-RLWM-version4.csv',index=False, header=True)
'''