'starting letter': 'C', 'length': 3 }, { 'category': 'animal', 'size': 'bigger', 'starting letter': 'D', 'length': 3 }, { 'category': 'object', 'size': 'smaller', 'starting letter': 'S', 'length': 4 }, { 'category': 'animal', 'size': 'bigger', 'starting letter': 'H', 'length': 5 }] dist_funcs = { 'category': 'lambda a, b: int(a!=b)', 'size': 'lambda a, b: int(a!=b)', 'starting letter': 'lambda a, b: int(a!=b)', 'length': 'lambda a, b: np.linalg.norm(np.subtract(a,b))' } egg = quail.Egg(pres=[next_presented], rec=[next_recalled], features=[next_features], dist_funcs=dist_funcs) egg.analyze('lagcrp').plot()
'starting letter': 'D', 'length': 3 }, { 'category': 'object', 'size': 'smaller', 'starting letter': 'S', 'length': 4 }, { 'category': 'animal', 'size': 'bigger', 'starting letter': 'B', 'length': 3 }] egg = quail.Egg(pres=[next_presented], rec=[next_recalled], features=[next_features]) # initialize fingerprint fingerprint = Fingerprint(init=egg) # initialize presenter params = {'fingerprint': fingerprint} presenter = OptimalPresenter(params=params, strategy='stabilize') # update the fingerprint fingerprint.update(egg) # reorder next list reordered_egg = presenter.order(egg, method='permute', nperms=100)
# -*- coding: utf-8 -*- """ ============================= Create an egg ============================= An egg is made up of two primary pieces of data: `pres`, which are the words/stimuli that were presented to a subject and `rec`, which are the words/stimuli that were recalled by the subject. """ # Code source: Andrew Heusser # License: MIT import quail # presented words presented_words = [['cat', 'bat', 'hat', 'goat'], ['zoo', 'animal', 'zebra', 'horse']] # recalled words recalled_words = [['bat', 'cat', 'goat', 'hat'], ['animal', 'horse', 'zoo']] # create egg egg = quail.Egg(pres=presented_words, rec=recalled_words)
'size': 'bigger', 'starting letter': 'H', 'length': 5 }, { 'item': 'DOG', 'category': 'animal', 'size': 'bigger', 'starting letter': 'D', 'length': 3 }, { 'item': 'CAT', 'category': 'animal', 'size': 'bigger', 'starting letter': 'C', 'length': 3 }] # set some custom distance functions dist_funcs = { 'category': 'lambda a, b: int(a!=b)', 'size': 'lambda a, b: int(a!=b)', 'starting letter': 'lambda a, b: int(a!=b)', 'length': 'lambda a, b: np.linalg.norm(np.subtract(a,b))' } egg = quail.Egg(pres=[presented], rec=[recalled], dist_funcs=dist_funcs) fegg = egg.analyze('lagcrp') fegg.plot()
pres1.append(l2) # Make recall words list of lists rec1 = np.load(subj_dir[s] + '/data/recall_data.npy') # This line repeats subjects recall twice to match the word presentations structure. Specifically, since words from their recall (which was one long recall of all 24 words) may be contained in either L1 or L2. rep_recalls = list( itertools.chain.from_iterable( itertools.repeat(x, 2) for x in rec1)) cond_list = condition_list(subj_dir, s) cond_list_all.append(cond_list) pres_subj = np.squeeze(pres1) presented_words.append(pres_subj) recalled_words.append(rep_recalls) pres2 = np.squeeze(presented_words) multisubject_egg = quail.Egg(pres=pres2.tolist(), rec=recalled_words) acc = multisubject_egg.analyze('accuracy') list_num = np.tile([0, 1], 12) ABA = {} ABA['L1'] = [] ABA['L2'] = [] AAA = {} AAA['L1'] = [] AAA['L2'] = [] AAB = {} AAB['L1'] = [] AAB['L2'] = []