From f17cb62cc305265b6aaa1807e231c54de4cbdd09 Mon Sep 17 00:00:00 2001 From: vanessambrown Date: Tue, 10 Apr 2018 10:24:25 -0400 Subject: [PATCH 1/3] add regret model --- vba/bandit_vba.m | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/vba/bandit_vba.m b/vba/bandit_vba.m index 82ffa40..ccf3895 100755 --- a/vba/bandit_vba.m +++ b/vba/bandit_vba.m @@ -31,7 +31,12 @@ % valence = 1; % elseif nargin<8 % %if we are fixing the parameters -% fix_all_params = 0; %This should really really be an extrenal variable, make this happen. + + +elseif valence && regret + n_theta = 4; + options.inF.valence = 1; + options.inF.regret = 1;% fix_all_params = 0; %This should really really be an extrenal variable, make this happen. % end @@ -42,6 +47,7 @@ use_first_150 = 0; + %% Where to look for data %Quick username check, and path setting @@ -65,11 +71,16 @@ options.GnFigs = 0; end %% set up dim defaults -if valence && ~disappointment +if valence && ~disappointment && ~regret n_theta = 3; %Number of evolution params (AlphaWin AlphaLoss LossDecay WinDecay) options.inF.valence = 1; options.inF.disappointment= 0; +elseif valence && regret + n_theta = 4; + options.inF.valence = 1; + options.inF.regret = 1; + elseif valence && disappointment n_theta = 4; %Number of evolution params (AlphaWin AlphaLoss LossDecay WinDecay) options.inF.valence = 1; From d914999c73bccb4b3d86279368ff2dfe282ebf7c Mon Sep 17 00:00:00 2001 From: vanessambrown Date: Tue, 10 Apr 2018 10:28:12 -0400 Subject: [PATCH 2/3] fix typos --- vba/bandit_vba.m | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/vba/bandit_vba.m b/vba/bandit_vba.m index ccf3895..9da1476 100755 --- a/vba/bandit_vba.m +++ b/vba/bandit_vba.m @@ -31,12 +31,7 @@ % valence = 1; % elseif nargin<8 % %if we are fixing the parameters - - -elseif valence && regret - n_theta = 4; - options.inF.valence = 1; - options.inF.regret = 1;% fix_all_params = 0; %This should really really be an extrenal variable, make this happen. +% fix_all_params = 0; %This should really really be an extrenal variable, make this happen. % end From 038840d3fb440b12e2a5a390f2feae307ed6e694 Mon Sep 17 00:00:00 2001 From: vanessambrown Date: Tue, 10 Apr 2018 10:30:55 -0400 Subject: [PATCH 3/3] added regret model --- vba/f_bandit_Qlearn.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vba/f_bandit_Qlearn.m b/vba/f_bandit_Qlearn.m index ae15e3b..cfbf3f7 100755 --- a/vba/f_bandit_Qlearn.m +++ b/vba/f_bandit_Qlearn.m @@ -24,18 +24,25 @@ end + if in.fix_decay %This is the fixed version %if in.decay %This logic is somewhat confusing... leave for relic vba data for now alpha_win = 1./(1+exp(-theta(1))); % learning rate is bounded between 0 and 1. alpha_loss = 1./(1+exp(-theta(2))); % learning rate is bounded between 0 and 1. decay=0.5; -elseif in.valence && ~in.disappointment +elseif in.valence && ~in.disappointment && ~in.regret %Params alpha_win = 1./(1+exp(-theta(1))); % learning rate is bounded between 0 and 1. alpha_loss = 1./(1+exp(-theta(2))); % learning rate is bounded between 0 and 1. decay = 1./(1+exp(-theta(3))); % decay is bounded between 0 and 1. % loss_decay = 1./(1+exp(-theta(3))); % learning rate is bounded between 0 and 1. % win_decay = 1./(1+exp(-theta(4))); % learning rate is bounded between 0 and 1. +elseif in.valence && in.regret + %Params + alpha_win = 1./(1+exp(-theta(1))); % learning rate is bounded between 0 and 1. + alpha_loss = 1./(1+exp(-theta(2))); % learning rate is bounded between 0 and 1. + decay = 1./(1+exp(-theta(3))); % decay is bounded between 0 and 1. + omega_r = 1./(1+exp(-theta(4))); % regret is bounded between 0 and 1. elseif in.valence && in.disappointment %Params alpha_win = 1./(1+exp(-theta(1))); % learning rate is bounded between 0 and 1. @@ -56,6 +63,8 @@ if in.disappointment r = (1 - omega)*r + omega*(stake - r); +elseif in.regret + r = omega_r*r + (1-omega_r)*(r-max(x)); end fx = zeros(length(x),1);