responses[i]) rt[i] = computeMeanRepresentativeSteps(step)[0] model.state = convertStimulus(np.array(model.state)) model.action = np.array(model.action) model.responses = np.array(model.responses) model.reaction = np.array(model.reaction) # ----------------------------------- # ----------------------------------- # HUMAN LEARNING # ----------------------------------- human = HLearning( dict({ 'meg': ('../../PEPS_GoHaL/Beh_Model/', 48), 'fmri': ('../../fMRI', 39) })) # ----------------------------------- # ----------------------------------- # PARAMETERS + INITIALIZATION # ----------------------------------- very_good_parameters = dict({ 'noise': 0.0001, 'length': 10, 'alpha': 0.8, 'beta': 3.0, 'gamma': 0.4, 'threshold': 4.0, 'gain': 2.0
model.state = convertStimulus(np.array(model.state)) model.action = np.array(model.action) model.responses = np.array(model.responses) model.reaction = np.array(model.reaction) model.reaction = center(model.reaction) # model.weights = np.array(model.weights) # model.p_wm =np.array(model.p_wm) # model.p_rl =np.array(model.p_rl) # # ----------------------------------- # ----------------------------------- # HUMAN LEARNING # ----------------------------------- human = HLearning(dict({'meg':('../../PEPS_GoHaL/Beh_Model/',48), 'fmri':('../../fMRI',39)})) # ----------------------------------- # ----------------------------------- # PARAMETERS + INITIALIZATION # ----------------------------------- parameters = dict({'noise':0.0001, 'length':10, 'alpha':0.8, 'beta':3.0, 'gamma':0.5, 'threshold':4.0, 'sigma':0.5, 'gain':2.0})
# sys.stdout.write("More help avalaible with -h or --help option") # sys.exit(0) parser = OptionParser() parser.add_option("-i", "--input", action="store", help="The name of the directory to load", default=False) (options, args) = parser.parse_args() # ----------------------------------- def center(x): x = x-np.median(x) x = x/(np.percentile(x, 75)-np.percentile(x, 25)) return x # ----------------------------------- # HUMAN LEARNING # ----------------------------------- human = HLearning(dict({'meg':('../../PEPS_GoHaL/Beh_Model/',42), 'fmri':('../../fMRI',39)})) tmp = np.reshape(human.reaction['fmri'], (14, 4*39)) tmp = np.array(map(center, tmp)) human.reaction['fmri'] = np.reshape(tmp, (14*4, 39)) # ----------------------------------- # ----------------------------------- # LOADING DATA # ----------------------------------- with open("beh_model.pickle", 'r') as handle: data = pickle.load(handle) # ----------------------------------- #order data # ----------------------------------- hpcr = extractStimulusPresentation(human.responses['fmri'], human.stimulus['fmri'], human.action['fmri'], human.responses['fmri'])
(options, args) = parser.parse_args() # ----------------------------------- def center(x): x = x - np.median(x) x = x / (np.percentile(x, 75) - np.percentile(x, 25)) return x # ----------------------------------- # HUMAN LEARNING # ----------------------------------- human = HLearning( dict({ 'meg': ('../../PEPS_GoHaL/Beh_Model/', 42), 'fmri': ('../../fMRI', 39) })) tmp = np.reshape(human.reaction['fmri'], (14, 4 * 39)) tmp = np.array(map(center, tmp)) human.reaction['fmri'] = np.reshape(tmp, (14 * 4, 39)) # ----------------------------------- # ----------------------------------- # LOADING DATA # ----------------------------------- with open("beh_model.pickle", 'r') as handle: data = pickle.load(handle) # ----------------------------------- #order data
# ----------------------------------- if not sys.argv[1:]: sys.stdout.write("Sorry: you must specify at least 1 argument") sys.stdout.write("More help avalaible with -h or --help option") sys.exit(0) parser = OptionParser() parser.add_option("-m", "--model", action="store", help="The name of the model to optimize", default=False) parser.add_option("-t", "--time", action="store", help="Time of execution", default=False) parser.add_option("-d", "--data", action="store", help="The data to fit", default=False) parser.add_option("-o", "--output", action="store", help="Output directory", default=False) (options, args) = parser.parse_args() # ----------------------------------- # ----------------------------------- # HUMAN LEARNING # ----------------------------------- human = HLearning(dict({'meg':('Beh/MEG/Beh_Model/',48), 'fmri':('Beh/fMRI',39)})) # ----------------------------------- # ----------------------------------- # POSSIBLE MODELS # ----------------------------------- models = dict({'bayesian':"BayesianWorkingMemory(['s1', 's2', 's3'], ['thumb', 'fore', 'midd', 'ring', 'little'], vars(options))", 'qlearning':"QLearning(['s1', 's2', 's3'], ['thumb', 'fore', 'midd', 'ring', 'little'], vars(options))", 'fusion':"FSelection(['s1', 's2', 's3'], ['thumb', 'fore', 'midd', 'ring', 'little'], vars(options))", 'kalman':"KalmanQLearning(['s1', 's2', 's3'], ['thumb', 'fore', 'midd', 'ring', 'little'], vars(options))", 'keramati':"KSelection(['s1', 's2', 's3'], ['thumb', 'fore', 'midd', 'ring', 'little'], vars(options))", }) # ----------------------------------- # ------------------------------------ # CREATE DIRECTORY RESULTS