Skip to content

Commit 6be9f83

Browse files
author
mdhumphries
committed
add alternate model
1 parent 77049ae commit 6be9f83

7 files changed

Lines changed: 12 additions & 41 deletions
857 Bytes
Binary file not shown.
463 Bytes
Binary file not shown.
Binary file not shown.

Replicate_Figure1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
rows_of_data = TestData.iloc[0:trial+1] # select all rows of data up to the curren trial; is trial+1 as dataframe includes colu
4343

44+
print(rows_of_data)
4445
#%%
4546
for index_strategy in range(len(strategies)):
4647
# run current strategy model on data up to current trial
1.16 KB
Binary file not shown.

strategy_test.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

strategymodels.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
@author: lpzmdh
1414
"""
1515

16+
########## rule strategies
1617
def go_left(rows):
1718
# checks if the subject chose the left option on this trial
1819
nTrials = len(rows);
@@ -34,5 +35,14 @@ def go_right(rows):
3435
trial_type = "failure"
3536
return trial_type
3637

38+
############ exploration strategies
3739

38-
40+
def alternate(rows):
41+
# checks if the subject made a different choice on this trial
42+
nTrials = len(rows);
43+
# "at" selects the value at the row/column location in the dataframe
44+
if nTrials > 1 & rows.at[nTrials-1,'Choice'] != rows.at[nTrials-2,'Choice']: # check the current trial's choice
45+
trial_type = "success"
46+
else:
47+
trial_type = "failure"
48+
return trial_type

0 commit comments

Comments
 (0)