plateform
stringclasses
1 value
repo_name
stringlengths
13
113
name
stringlengths
3
74
ext
stringclasses
1 value
path
stringlengths
12
229
size
int64
23
843k
source_encoding
stringclasses
9 values
md5
stringlengths
32
32
text
stringlengths
23
843k
github
qihongl/mathCognition_PDP_RL-master
trainOne.m
.m
mathCognition_PDP_RL-master/[past]/sim22.0_touchInput/trainOne.m
766
utf_8
f3211fdddc8a90f2cb37ab64dfcdfc99
% just testing, a short cut for running the model function record = trainOne(epoch, seed) clear global if nargin == 0 epoch = 10000; seed = randi(99); % seed = 66 end %% run the simulation global p record = trainAgent(epoch, seed); % save the simulation results saveDirName = getSaveDir(); save([saveDi...
github
qihongl/mathCognition_PDP_RL-master
showWeights.m
.m
mathCognition_PDP_RL-master/[past]/sim22.0_touchInput/showWeights.m
583
utf_8
a5170d34eef2535437720fe5e1a446a5
function [ ] = showWeights( ) % plot the weights of the model global p d a; % plot weights around fovea axes(d.heatWts) % imagesc(-p.eyeRad:p.eyeRad,-p.mvRad:p.mvRad+1, a.wts) visualizeWeightsMatrix(a.wts) title(d.heatWts, 'Weights: visual -> action', 'fontsize', d.FONTSIZE) xlabel(d.heatWts, 'Visual input layer', 'fon...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/[past]/sim22.0_touchInput/updateWeights.m
2,693
utf_8
dd6cf90843b639edb61c2d98d1a02acc
% written by professor Jay McClelland function [ ] = updateWeights() % this function controls: % 1. the reward policy % 2. the weight update % 3. activate the "teaching" global p a w buffer; %% compute the reward values according to the reward policy % compute the true reward at this time step a.curRwd = compu...
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/[past]/sim22.0_touchInput/showState.m
2,369
utf_8
c21f87f660c0fca0cff629e57b109e9f
% written by professor Jay McClelland function [ ] = showState( ) global p w d a; %% plot current and expected rewards over time axes(d.rwd); plot(w.rS.time,a.curRwd,'-b*'); hold on; plot(w.rS.time,a.expRwd,'-r*'); legend({'current reward', 'esimtated reward'},... 'Location','northwest', 'fontsize', d.F...
github
qihongl/mathCognition_PDP_RL-master
initParams.m
.m
mathCognition_PDP_RL-master/[past]/sim22.0_touchInput/initParams.m
3,622
utf_8
4ac7957e0b4493722f363ff2d19a6917
% written by professor Jay McClelland function [] = initParams(epoch) % Initialize and preallocate the parameters needed for the model. global p a buffer %% simulation parameters p.runs = epoch; % training upper lim p.maxIter = 100; % terminate if cannot finish in 100 iter p.saveWtsInterval =...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/[past]/sim22.0_touchInput/updateState.m
1,139
utf_8
6c4fb41b626e6f9ba4590073f39bc3fa
% written by professor Jay McClelland function [ ] = updateState() %this function uses the real state to update the internal state %after Act is called to execute the hand or eye movement action global w h p a; %% compute the relative locations % the relative locations of eye and hand w.vS.eyePos = 0; w.vS....
github
qihongl/mathCognition_PDP_RL-master
initState.m
.m
mathCognition_PDP_RL-master/[past]/sim22.0_touchInput/initState.m
1,835
utf_8
50fdda048c2df17889bc904eaa8eca0d
% written by professor Jay McClelland function [ ] = initState( ) global a w h p mode; %realState is characterized by the position of a target to touch, %position of eye, and position of hand 1-d space %viewedState is the input I have given that my eye and hand are %at particular positions w.r.t. the realSt...
github
qihongl/mathCognition_PDP_RL-master
updateBuffer.m
.m
mathCognition_PDP_RL-master/[past]/sim22.0_touchInput/updateBuffer.m
1,526
utf_8
a8800fed2e034da1b49ad2543a9a41e2
%% update the memory buffer using the current experience function [ ] = updateBuffer() global p a w buffer; memoryIdx = min(a.bufferUsage+1, p.bufferSize); if a.bufferUsage+1 <= p.bufferSize saveCurrentExperience(memoryIdx) else % delete the 1st experience in the buffer buffer(1) = []; % preallocate a...
github
qihongl/mathCognition_PDP_RL-master
trainAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim22.0_touchInput/trainAgent.m
1,880
utf_8
0a146998e62a71cdc4f21eebb53ea185
%% Trains the network n trials % written by professor Jay McClelland function [record] = trainAgent(epoch, seed) %% initialization % initialize parameters global p a w mode; initParams(epoch); p.seed = seed; rng(seed) % preallocate record.wts = cell(1,epoch / p.saveWtsInterval+1); s.steps = nan(1,epoch); ...
github
qihongl/mathCognition_PDP_RL-master
computeExpectedReward.m
.m
mathCognition_PDP_RL-master/[past]/sim22.0_touchInput/computeExpectedReward.m
795
utf_8
bf22d95e531588e0a74e43c7ac747fc9
%% compute the expected reward with the Q learning rule %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % given: act_next predicted Q value % s_cur current state (input) % r_cur current actual reward % taskDone if the task is terminated % return: d...
github
qihongl/mathCognition_PDP_RL-master
chooseAction.m
.m
mathCognition_PDP_RL-master/[past]/sim03_Xitems/chooseAction.m
397
utf_8
fffb433a0ee855f4dd40db7fe24da0ca
function [action] = chooseAction(w,p,a) % obtain the probability distribution for actions prob = softmax(a.q(w.curs+1,:), p.qscale); % choose action based action = sample(prob); end function [action] = sample(pr) rv = rand(1); % sample from a unifrom[0,1] cp = cumsum(pr); for i = 1:length(pr) % choose an a...
github
qihongl/mathCognition_PDP_RL-master
softmax.m
.m
mathCognition_PDP_RL-master/[past]/sim03_Xitems/softmax.m
622
utf_8
90f2f58a719facf0fbef333ac0a0b761
% SOFTMAX assign probabilities to options % in my case, x is expected to be a vector of q values for a state: Q(s,:) function [prob] = softmax(x, scale) % if there is no input scaling factor, just don't scale it if nargin == 1 scale = 1; end % transform when there is negative values % TODO: this transformation i...
github
qihongl/mathCognition_PDP_RL-master
initState.m
.m
mathCognition_PDP_RL-master/[past]/sim03_Xitems/initState.m
951
utf_8
eb244da6de076ac9b70edeb21dcc59bb
% INITSTATE initialize the state parameters, or set up the "world" % note that all things here are TRIAL SPECIFIC % originally written by Professor Jay McClelland function [w] = initState(p) % preallocation w.curs = 0; % current state w.cura = 0; % current action w.nexts = 0; % next state w.nexta =...
github
qihongl/mathCognition_PDP_RL-master
touch.m
.m
mathCognition_PDP_RL-master/[past]/sim03_Xitems/touch.m
1,801
utf_8
342ffa773bb2ffe05e52acdd0eb1f5e2
%% a RL based model for counting function output = touch(epochs, seed, doPlotting, showSteps, showProgress) if nargin == 0 epochs = 100; seed = randi(99); doPlotting = true; showSteps = false; showProgress = false; end rng(seed); %% initialization % modeing parameters p = setupParameters(epochs); % preallocat...
github
qihongl/mathCognition_PDP_RL-master
setupParameters.m
.m
mathCognition_PDP_RL-master/[past]/sim03_Xitems/setupParameters.m
704
utf_8
09d63fb7966847f1c4fc72c0e9c8384d
%SETUPPARAMETERS returns the parameters for the model function [p] = setupParameters(epochs) % number of training epochs p.trials = epochs; % modeling parameters p.gamma = 0.5; % discount factor p.alpha = 0.2; % learning rate p.qscale = 3; % softmax scaling factor % other parameters p.range = 6; ...
github
qihongl/mathCognition_PDP_RL-master
runAgent.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouchTemplate/runAgent.m
479
utf_8
64604dab4ae301f43144dd7967efcd2d
% written by professor Jay McClelland function [ results ] = runAgent( ) %UNTITLED11 Summary of this function goes here % Detailed explanation goes here global a w h p d; initState(); updateState(); showState(); i = 0; while w.rS.handPos ~= w.rS.targPos && i < 50 selectAction(); Act(); updat...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouchTemplate/updateWeights.m
532
utf_8
6f5ad6a5a737cae150113a230254b5cc
% written by professor Jay McClelland function [ ] = updateWeights( ) global a w p; % change in weights equals input times reward prediction error if w.rS.handPos == w.rS.targPos Rwd = 1; else Rwd = max(a.wts*w.vS.visInput'); end a.Rwd = Rwd; a.dfRwd = Rwd*p.gamma^w.rS.td; % isize = min(abs(a.dfRwd...
github
qihongl/mathCognition_PDP_RL-master
selectAction.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouchTemplate/selectAction.m
1,344
utf_8
2b940e8b250810b9007f5be48f267838
% written by professor Jay McClelland function [] = selectAction( ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here global w a p; %% compute the normalized activation % a.net = a.wts * w.vS.visInput'; % scnet = p.smgain*a.net; % a.act = exp(scnet)/sum(exp(scnet)); %% compute ...
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouchTemplate/showState.m
1,044
utf_8
9698c2fb8721bcf88d25036a172a1c38
% written by professor Jay McClelland function [ ] = showState( ) %UNTITLED Summary of this function goes here % Detailed explanation goes here global w d a h; %plot the positions of eye, hand, and target in the real state % axes(d.rSax); % cla; % plot(d.rSax,[-50 50],[0 0]); hold on; % plot(d.rSax,-50:5...
github
qihongl/mathCognition_PDP_RL-master
initParamsEtc.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouchTemplate/initParamsEtc.m
970
utf_8
b4218481cee376921d7758b4f704e786
% written by professor Jay McClelland function [] = initParamsEtc( ) % global p d a p.wf = .15; % p.handTime = 5; % the amount of time needed to move hand p.eyeTime = 1; % the amount of time needed to move eye p.learner = 1; % p.lrate = .1; % alpha p.runs = 4096; % epochs p.gamma ...
github
qihongl/mathCognition_PDP_RL-master
choose.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouchTemplate/choose.m
337
utf_8
54e0f53b425d2927e123310d920c7989
% written by professor Jay McClelland function [ choice ] = choose(strengths) %choose one of n alternatives according to it's strength v = rand; % a number between 0 and 1 nstr = strengths/sum(strengths); %normalize strengths cstr = cumsum(nstr); %get top edges of bins choice = find(cstr>v,1); %returns the bin v ...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouchTemplate/updateState.m
864
utf_8
ced4327b0d1a8f127ea3f5692b785e6a
% written by professor Jay McClelland function [ ] = updateState() %this function uses the real state to update the internal state %after Act is called to execute the hand or eye movement action global w a d h p; w.vS.eyePos = 0; % assume we can target the hand position perfectly w.vS.handPos = w.rS.handPos ...
github
qihongl/mathCognition_PDP_RL-master
initState.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouchTemplate/initState.m
1,262
utf_8
e2101e924706caaf51b295575f7e9aed
% written by professor Jay McClelland function [ ] = initState( ) global a w d h p; %realState is characterized by the position of a target to touch, %position of eye, and position of hand %in a 101-pixel one-d space %viewedState is the input I have given that my eye and hand a...
github
qihongl/mathCognition_PDP_RL-master
trainAgent.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouchTemplate/trainAgent.m
443
utf_8
ab5a17557f164e2c141d66db305d4a88
% written by professor Jay McClelland function [record] = trainAgent( ) global p d a; initParamsEtc(); run = struct('results',[]); di = 1; for i = 1:p.runs run.results = runAgent(); a.smgain = a.smgain + p.smirate; if i == d.dtimes(di) prstr = sprintf('%d: ',i); rstr = input(prstr,...
github
qihongl/mathCognition_PDP_RL-master
Act.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouchTemplate/Act.m
656
utf_8
6a60c5c1c7a2c99fd43c15d4de1944e6
% written by professor Jay McClelland function [ ] = Act( ) % here we act according to the action selected % by selectAction global w p; %% where are hand and eye in rS w.rS.handPos = w.rS.handPos + w.out.handStep; w.rS.eyePos = w.rS.eyePos + w.out.eyeStep; w.rS.td = 1; % the time difference w.rS.time = w...
github
qihongl/mathCognition_PDP_RL-master
runAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim16.2_punFac/runAgent.m
1,392
utf_8
f58afc19f6593a1d0bea36a8402e7dca
% written by professor Jay McClelland function [ results ] = runAgent() global a w h p mode; % rng(seed) % w.seed = seed; %% initialize the state initState(); updateState(); computeAnswer(); % compute the true 'answers' %% training the model once i = 0; indices = zeros(1,p.maxIter); while ~(w.done) &...
github
qihongl/mathCognition_PDP_RL-master
trainOne.m
.m
mathCognition_PDP_RL-master/[past]/sim16.2_punFac/trainOne.m
489
utf_8
480fbd634b40a2e355805264ff3e4ac7
% just testing, a short cut for running the model function record = trainOne(epoch, seed) if nargin == 0 epoch = 5000; seed = randi(99); end %% run the simulation record = trainAgent(epoch, seed); %% save the simulation results saveDirName = getSaveDir(); save([saveDirName '/' 'record'],'record'); save('recor...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/[past]/sim16.2_punFac/updateWeights.m
764
utf_8
04391ab808a2c6442632b5f50d71b7e8
% written by professor Jay McClelland function [ ] = updateWeights() % this function controls: % 1. the reward policy % 2. the weight update % 3. activate the "teaching" global p a w; %% compute the reward values according to the reward policy curRwd = computeRwd(); expRwd = max(a.wts*w.vS.visInput'); %% assi...
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/[past]/sim16.2_punFac/showState.m
1,317
utf_8
177371f3562e9304f1bf71be51424ff1
% written by professor Jay McClelland function [ ] = showState( ) global p w d a; % plot current and expected rewards over time axes(d.rwd); plot(w.rS.time,a.Rwd,'-b*'); hold on; plot(w.rS.time,a.dfRwd,'-r*'); legend({'current reward', 'discounted future reward'},... 'Location','northwest', 'fontsize', d.F...
github
qihongl/mathCognition_PDP_RL-master
move.m
.m
mathCognition_PDP_RL-master/[past]/sim16.2_punFac/move.m
403
utf_8
76f0765b052705d3747442411be8e898
% written by professor Jay McClelland function [ ] = move( ) % here we act according to the action selected % by selectAction global w; %% perform the actions % update the real locations of hand and eye w.rS.handPos = w.rS.handPos + w.out.handStep; w.rS.eyePos = w.rS.eyePos + w.out.eyeStep; w.rS.td = 1; ...
github
qihongl/mathCognition_PDP_RL-master
initParams.m
.m
mathCognition_PDP_RL-master/[past]/sim16.2_punFac/initParams.m
1,845
utf_8
80b107e35451b5e7017cdff4174b89a3
% written by professor Jay McClelland function [] = initParams(epoch) % This program initialize and preallocate the parameters needed for the % model. This should be executed before the simulations. global p a %% modeling parameters p.runs = epoch; % training upper lim p.maxIter = 100; % terminate if...
github
qihongl/mathCognition_PDP_RL-master
computeRwd2.m
.m
mathCognition_PDP_RL-master/[past]/sim16.2_punFac/computeRwd2.m
1,731
utf_8
bb2799e2a46161ad5a12b2658bbcd32f
function rwd = computeRwd2() %% this function controls the reward policy global w p h; w.actionCorrect = true; if isNext() w.rS.targRemain(w.rS.handPos == w.rS.targPos) = false; rwd = p.r.midPos; if ~targetRemain() rwd = p.r.midPos; w.done = true; end else if w.rS.handPos < nextOb...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/[past]/sim16.2_punFac/updateState.m
951
utf_8
6c3388db9d1faa1711f00bbbdbd2b961
% written by professor Jay McClelland function [ ] = updateState() %this function uses the real state to update the internal state %after Act is called to execute the hand or eye movement action global w h p a; %% compute the relative locations % the relative locations of eye and hand w.vS.eyePos = 0; w.vS....
github
qihongl/mathCognition_PDP_RL-master
initState.m
.m
mathCognition_PDP_RL-master/[past]/sim16.2_punFac/initState.m
1,594
utf_8
d62eadf6f64277fd0e0e4533bcc1baf3
% written by professor Jay McClelland function [ ] = initState( ) global a w h p mode; %realState is characterized by the position of a target to touch, %position of eye, and position of hand 1-d space %viewedState is the input I have given that my eye and hand are %at particular positions w.r.t. the realSt...
github
qihongl/mathCognition_PDP_RL-master
plotResults.m
.m
mathCognition_PDP_RL-master/[past]/sim16.2_punFac/plotResults.m
544
utf_8
da928d22f60607e06a82b5f24fe4b624
function plotResults(record) global d; % initialize the parameters for the plot d.fh = figure(); d.fh.WindowStyle = 'docked'; d.rax = subplot(3,1,1); d.hax = subplot(3,1,2); d.wax = subplot(3,1,3); % d.dtimes = 2.^(10:10); % load('record.mat'); for i = 1 : size(record.r{size(record.r,2)}.h,2) plotRes(i, record); e...
github
qihongl/mathCognition_PDP_RL-master
trainAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim16.2_punFac/trainAgent.m
1,241
utf_8
e0470615613797744739937eed5b812e
%% Trains the network n trials % written by professor Jay McClelland function [record] = trainAgent(epoch, seed) %% initialization % initialize parameters global p a w mode; initParams(epoch); p.seed = seed; rng(seed) % preallocate record.a = cell(1,epoch); s.steps = nan(1,epoch); s.indices = cell(1,epo...
github
qihongl/mathCognition_PDP_RL-master
computeRwd.m
.m
mathCognition_PDP_RL-master/[past]/sim16.2_punFac/computeRwd.m
2,255
utf_8
ffb5370d99695989298f09793052de31
function Rwd = computeRwd() %% this function controls the reward policy global w p h a; w.actionCorrect = true; % if there is remaining items if targetRemain() if w.out.handStep == 0 % not moving Rwd = p.r.smallNeg; elseif ~isTouchingObj % touching empty spot Rwd = p.r.smallNeg; e...
github
qihongl/mathCognition_PDP_RL-master
runAgent.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouch/runAgent.m
477
utf_8
dbc7fe877cd329404d69ca2895247162
% written by professor Jay McClelland function [ results ] = runAgent( ) %UNTITLED11 Summary of this function goes here % Detailed explanation goes here global a w h p d; initState(); updateState(); showState(); i = 0; while w.rS.handPos ~= w.rS.targPos && i < 50 selectAction(); Act(); upd...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouch/updateWeights.m
684
utf_8
b587e5cac41aa9be2130eeed1a3a78cd
% written by professor Jay McClelland function [ ] = updateWeights( ) global a w p; % change in weights equals input times reward prediction error if w.rS.handPos == w.rS.targPos aRwd = 1; %was Rwd actual reward % else % Rwd = max(a.wts*w.vS.visInput'); end eRwd = max(a.wts*w.vS.visInput'); a.Rwd =...
github
qihongl/mathCognition_PDP_RL-master
selectAction.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouch/selectAction.m
867
utf_8
d70c66106d4e469fe255bd2b557d3731
% written by professor Jay McClelland function [] = selectAction( ) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here global w a p; targGuess = choose(w.vS.visInput) - 51; if p.learner == 0 if abs(targGuess) < 3 w.out.chooseHand = 1; else w.out.choo...
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouch/showState.m
1,044
utf_8
9698c2fb8721bcf88d25036a172a1c38
% written by professor Jay McClelland function [ ] = showState( ) %UNTITLED Summary of this function goes here % Detailed explanation goes here global w d a h; %plot the positions of eye, hand, and target in the real state % axes(d.rSax); % cla; % plot(d.rSax,[-50 50],[0 0]); hold on; % plot(d.rSax,-50:5...
github
qihongl/mathCognition_PDP_RL-master
initParamsEtc.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouch/initParamsEtc.m
731
utf_8
cbc24e0e0866e3e43e5f10fc830a33a5
% written by professor Jay McClelland function [] = initParamsEtc( ) % global p d a p.wf = .25; p.handTime = 5; % the amount of time needed to move hand p.eyeTime = 1; % the amount of time needed to move eye p.learner = 1; % p.lrate = .01; % alpha p.runs = 4096; % epochs p.gamma =...
github
qihongl/mathCognition_PDP_RL-master
choose.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouch/choose.m
337
utf_8
54e0f53b425d2927e123310d920c7989
% written by professor Jay McClelland function [ choice ] = choose(strengths) %choose one of n alternatives according to it's strength v = rand; % a number between 0 and 1 nstr = strengths/sum(strengths); %normalize strengths cstr = cumsum(nstr); %get top edges of bins choice = find(cstr>v,1); %returns the bin v ...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouch/updateState.m
849
utf_8
9af3d70b2c713638037079e192297aed
% written by professor Jay McClelland function [ ] = updateState() %this function uses the real state to update the internal state %after Act is called to execute the hand or eye movement action global w a d h p; w.vS.eyePos = 0; w.vS.handPos = w.rS.handPos - w.rS.eyePos; % the next line is the apparent new ...
github
qihongl/mathCognition_PDP_RL-master
initState.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouch/initState.m
1,321
utf_8
ac61257c191f02357b18d06327446712
% written by professor Jay McClelland function [ ] = initState( ) global a w d h p; %realState is characterized by the position of a target to touch, %position of eye, and position of hand %in a 101-pixel one-d space %viewedState is the input I have given that my eye and hand a...
github
qihongl/mathCognition_PDP_RL-master
trainAgent.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouch/trainAgent.m
443
utf_8
ab5a17557f164e2c141d66db305d4a88
% written by professor Jay McClelland function [record] = trainAgent( ) global p d a; initParamsEtc(); run = struct('results',[]); di = 1; for i = 1:p.runs run.results = runAgent(); a.smgain = a.smgain + p.smirate; if i == d.dtimes(di) prstr = sprintf('%d: ',i); rstr = input(prstr,...
github
qihongl/mathCognition_PDP_RL-master
updateWeights_v2.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouch/updateWeights_v2.m
916
utf_8
cd5edb43c669077fb18aad932a218cd9
% written by professor Jay McClelland % not currently used - this version adds the actual reward and disc future % reward rather than using the actual if obtained and disc future rwd % otherwise function [ ] = updateWeights( ) global a w p; % change in weights equals input times reward prediction error if w.rS...
github
qihongl/mathCognition_PDP_RL-master
Act.m
.m
mathCognition_PDP_RL-master/[past]/demo_fixTouch/Act.m
376
utf_8
7dd57f820956d2e27329a066504c09c4
% written by professor Jay McClelland function [ ] = Act( ) % here we act according to the action selected % by selectAction global w p; if w.out.chooseHand == 1 w.rS.handPos = w.rS.handPos + w.out.handStep; w.rS.td = p.handTime; else w.rS.eyePos = w.rS.eyePos + w.out.eyeStep; w.rS.td = p....
github
qihongl/mathCognition_PDP_RL-master
runAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/runAgent.m
1,493
utf_8
3af998953e263322252c3725d0de8f54
% written by professor Jay McClelland function [ results ] = runAgent() global a w h p mode; %% initialize the state initState(); updateState(); computeAnswer(); % compute the true 'answers' %% training the model once i = 0; indices = zeros(1,p.maxIter); while ~(w.done) && i < p.maxIter %% choose ...
github
qihongl/mathCognition_PDP_RL-master
trainOne.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/trainOne.m
490
utf_8
53151cd96a63c8a9cea27f940568c818
% just testing, a short cut for running the model function record = trainOne(epoch, seed) if nargin == 0 epoch = 10000; seed = randi(99); end %% run the simulation record = trainAgent(epoch, seed); %% save the simulation results saveDirName = getSaveDir(); save([saveDirName '/' 'record'],'record'); save('reco...
github
qihongl/mathCognition_PDP_RL-master
showWeights.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/showWeights.m
583
utf_8
a5170d34eef2535437720fe5e1a446a5
function [ ] = showWeights( ) % plot the weights of the model global p d a; % plot weights around fovea axes(d.heatWts) % imagesc(-p.eyeRad:p.eyeRad,-p.mvRad:p.mvRad+1, a.wts) visualizeWeightsMatrix(a.wts) title(d.heatWts, 'Weights: visual -> action', 'fontsize', d.FONTSIZE) xlabel(d.heatWts, 'Visual input layer', 'fon...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/updateWeights.m
830
utf_8
c4affc82b8bfaac2f17165602e3c4a34
% written by professor Jay McClelland function [ ] = updateWeights() % this function controls: % 1. the reward policy % 2. the weight update % 3. activate the "teaching" global p a w; %% compute the reward values according to the reward policy curRwd = computeRwd(); expRwd = max(a.wts*w.vS.visInput'); if ~w...
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/showState.m
2,195
utf_8
04a85884cc5f6e7cf26638c607de124f
% written by professor Jay McClelland function [ ] = showState( ) global p w d a; %% plot current and expected rewards over time axes(d.rwd); plot(w.rS.time,a.Rwd,'-b*'); hold on; plot(w.rS.time,a.dfRwd,'-r*'); legend({'current reward', 'discounted future reward'},... 'Location','northwest', 'fontsize',...
github
qihongl/mathCognition_PDP_RL-master
move.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/move.m
403
utf_8
a8c158962dd0428e90aff3bada221b17
% written by professor Jay McClelland function [ ] = move( ) % here we act according to the action selected by selectAction() global w; %% perform the actions % update the real locations of hand and eye w.rS.handPos = w.rS.handPos + w.out.handStep; w.rS.eyePos = w.rS.eyePos + w.out.eyeStep; w.rS.td = 1; ...
github
qihongl/mathCognition_PDP_RL-master
initParams.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/initParams.m
2,515
utf_8
cababa8a13fd9c153c5794dad3d818b1
% written by professor Jay McClelland function [] = initParams(epoch) % This program initialize and preallocate the parameters needed for the % model. This should be executed before the simulations. global p a p.teachingStyle = 4; % 1 = final reward only % 2 = intermediate reward % 3 = final reward only + tea...
github
qihongl/mathCognition_PDP_RL-master
computeRwd2.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/computeRwd2.m
1,991
utf_8
45c515cd014a3a3691c14f39d80b2c7a
function Rwd = computeRwd2() %% this function controls the reward policy global w p h a; w.actionCorrect = true; if w.out.handStep == 0 % not moving Rwd = p.r.smallNeg; elseif ~isTouchingObj % touching empty spot Rwd = p.r.smallNeg; elseif objIsTouched % touching touched object Rwd = p.r...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/updateState.m
1,094
utf_8
953f352a266c90e433fa16c58844ff12
% written by professor Jay McClelland function [ ] = updateState() %this function uses the real state to update the internal state %after Act is called to execute the hand or eye movement action global w h p a; %% compute the relative locations % the relative locations of eye and hand w.vS.eyePos = 0; w.vS....
github
qihongl/mathCognition_PDP_RL-master
initState.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/initState.m
1,623
utf_8
58ea3381194546e090037cf1e5458be7
% written by professor Jay McClelland function [ ] = initState( ) global a w h p mode; %realState is characterized by the position of a target to touch, %position of eye, and position of hand 1-d space %viewedState is the input I have given that my eye and hand are %at particular positions w.r.t. the realSt...
github
qihongl/mathCognition_PDP_RL-master
plotResults.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/plotResults.m
544
utf_8
da928d22f60607e06a82b5f24fe4b624
function plotResults(record) global d; % initialize the parameters for the plot d.fh = figure(); d.fh.WindowStyle = 'docked'; d.rax = subplot(3,1,1); d.hax = subplot(3,1,2); d.wax = subplot(3,1,3); % d.dtimes = 2.^(10:10); % load('record.mat'); for i = 1 : size(record.r{size(record.r,2)}.h,2) plotRes(i, record); e...
github
qihongl/mathCognition_PDP_RL-master
trainAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/trainAgent.m
1,501
utf_8
61e7aeb84f1a92e22f73306d60a6cdcd
%% Trains the network n trials % written by professor Jay McClelland function [record] = trainAgent(epoch, seed) %% initialization % initialize parameters global p a w mode; initParams(epoch); p.seed = seed; rng(seed) % preallocate record.a = cell(1,epoch); s.steps = nan(1,epoch); s.indices = cell(1,epoch...
github
qihongl/mathCognition_PDP_RL-master
computeRwd.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5_compleUnit/computeRwd.m
2,501
utf_8
34e581ed0bd67cb9271f5978ee6c956f
function Rwd = computeRwd() %% this function controls the reward policy global w p h a; w.actionCorrect = true; % if there is remaining items if targetRemain() if a.choice == p.mvRange +1 % saying "done" Rwd = p.r.smallNeg; w.errors = w.errors + 1; w.done = true; elseif a.choice == ...
github
qihongl/mathCognition_PDP_RL-master
runAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5.3_sigmoid/runAgent.m
935
utf_8
63e17518c01b818647117d4c4ed5b343
% written by professor Jay McClelland function [ results ] = runAgent() global a w h p mode; %% initialize the state initState(); updateState(); computeAnswer(); % compute the true 'answers' %% training the model once i = 0; indices = zeros(1,p.maxIter); while ~(w.done) && i < p.maxIter %% choose ...
github
qihongl/mathCognition_PDP_RL-master
trainOne.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5.3_sigmoid/trainOne.m
594
utf_8
b04fa7f72976b17585c806628b34dfe6
% just testing, a short cut for running the model function record = trainOne(epoch, seed) if nargin == 0 epoch = 10000; seed = randi(99); end %% run the simulation record = trainAgent(epoch, seed); %% save the simulation results saveDirName = getSaveDir(); save([saveDirName '/' 'record'],'record'); save('reco...
github
qihongl/mathCognition_PDP_RL-master
showWeights.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5.3_sigmoid/showWeights.m
773
utf_8
56b009e4997900472132fa009bf09ed3
function [ ] = showWeights( ) % plot the weights of the model global p d a; % wts from visual input to hidden axes(d.wts_VH) imagesc(a.wts_VH) title(d.wts_VH, 'Weights: visual -> hidden', 'fontsize', d.FONTSIZE) xlabel(d.wts_VH, 'Visual input layer', 'fontsize', d.FONTSIZE) ylabel(d.wts_VH, 'Hidden layer', 'fontsize',...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5.3_sigmoid/updateWeights.m
1,038
utf_8
bfd48c555d301bc8bcc5c70fb23ca954
% written by professor Jay McClelland function [ ] = updateWeights() % this function controls: % 1. the reward policy % 2. the weight update % 3. activate the "teaching" global p a w; %% compute the reward values according to the reward policy a.curRwd = computeRwd(); a.aAct_next = a.wts_HA*sigmoid(a.wts_VH * ...
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5.3_sigmoid/showState.m
2,342
utf_8
bd66686c8e3378bba847040f75636451
% written by professor Jay McClelland function [ ] = showState( ) global p w d a; %% plot current and expected rewards over time axes(d.rwd); plot(w.rS.time,a.curRwd,'-b*'); hold on; plot(w.rS.time,a.expRwd,'-r*'); legend({'current reward', 'estimated future reward'},... 'Location','northwest', 'fontsiz...
github
qihongl/mathCognition_PDP_RL-master
initParams.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5.3_sigmoid/initParams.m
2,278
utf_8
533b158e03aa0dbb7e60dc633e41dedd
% written by professor Jay McClelland function [] = initParams(epoch) % This program initialize and preallocate the parameters needed for the % model. This should be executed before the simulations. global p a p.teachingStyle = 4; % 1 = final reward only % 2 = intermediate reward % 3 = final reward only + tea...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5.3_sigmoid/updateState.m
1,022
utf_8
a5543b71621025d356ba32965449739a
% written by professor Jay McClelland function [ ] = updateState() %this function uses the real state to update the internal state %after Act is called to execute the hand or eye movement action global w h p a; %% compute the relative locations % the relative locations of eye and hand w.vS.eyePos = 0; w.vS....
github
qihongl/mathCognition_PDP_RL-master
initState.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5.3_sigmoid/initState.m
1,753
utf_8
7c3c8f8878f051bc61f77927e8b048d7
% written by professor Jay McClelland function [ ] = initState( ) global a w h p mode; %realState is characterized by the position of a target to touch, %position of eye, and position of hand 1-d space %viewedState is the input I have given that my eye and hand are %at particular positions w.r.t. the realSt...
github
qihongl/mathCognition_PDP_RL-master
trainAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim16.5.3_sigmoid/trainAgent.m
1,501
utf_8
704f98828c45de576b681eb325399789
%% Trains the network n trials % written by professor Jay McClelland function [record] = trainAgent(epoch, seed) %% initialization % initialize parameters global p a w mode; initParams(epoch); p.seed = seed; rng(seed) % preallocate record.a = cell(1,epoch); s.steps = nan(1,epoch); s.indices = cell(1,epoch...
github
qihongl/mathCognition_PDP_RL-master
runAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim16.8_hiddenUnits/runAgent.m
993
utf_8
20e3f9ffb9184133ad47bd682682186e
% written by professor Jay McClelland function [ results ] = runAgent() global a w h p mode; %% initialize the state initState(); updateState(); computeAnswer(); %% training the model once i = 0; indices = zeros(1,p.maxIter); while ~(w.done) && i < p.maxIter %% choose action selectAction(); ...
github
qihongl/mathCognition_PDP_RL-master
trainOne.m
.m
mathCognition_PDP_RL-master/[past]/sim16.8_hiddenUnits/trainOne.m
490
utf_8
53151cd96a63c8a9cea27f940568c818
% just testing, a short cut for running the model function record = trainOne(epoch, seed) if nargin == 0 epoch = 10000; seed = randi(99); end %% run the simulation record = trainAgent(epoch, seed); %% save the simulation results saveDirName = getSaveDir(); save([saveDirName '/' 'record'],'record'); save('reco...
github
qihongl/mathCognition_PDP_RL-master
showWeights.m
.m
mathCognition_PDP_RL-master/[past]/sim16.8_hiddenUnits/showWeights.m
773
utf_8
56b009e4997900472132fa009bf09ed3
function [ ] = showWeights( ) % plot the weights of the model global p d a; % wts from visual input to hidden axes(d.wts_VH) imagesc(a.wts_VH) title(d.wts_VH, 'Weights: visual -> hidden', 'fontsize', d.FONTSIZE) xlabel(d.wts_VH, 'Visual input layer', 'fontsize', d.FONTSIZE) ylabel(d.wts_VH, 'Hidden layer', 'fontsize',...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/[past]/sim16.8_hiddenUnits/updateWeights.m
1,927
utf_8
2149de990aadca0a43ab29b938948673
% written by professor Jay McClelland function [ ] = updateWeights() % this function controls: % 1. the reward policy % 2. the weight update % 3. activate the "teaching" global p a w; %% compute the reward values according to the reward policy curRwd = computeRwd(); a.aAct_next = a.wts_HA*sigmoid(a.wts_VH * w....
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/[past]/sim16.8_hiddenUnits/showState.m
2,161
utf_8
33d849cf16ea8fb1c5e0f476aa23c64b
% written by professor Jay McClelland function [ ] = showState( ) global p w d a; %% plot current and expected rewards over time axes(d.rwd); plot(w.rS.time,a.Rwd,'-b*'); hold on; plot(w.rS.time,a.dfRwd,'-r*'); legend({'current reward', 'discounted future reward'},... 'Location','northwest', 'fontsize',...
github
qihongl/mathCognition_PDP_RL-master
move.m
.m
mathCognition_PDP_RL-master/[past]/sim16.8_hiddenUnits/move.m
404
utf_8
f991ccf8031e923e5cb7bf57714e0235
% written by professor Jay McClelland function [ ] = move( ) % here we act according to the action selected by selectAction() global w; %% perform the actions % update the real locations of hand and eye w.rS.handPos = w.rS.handPos + w.out.handStep; w.rS.eyePos = w.rS.eyePos + w.out.eyeStep; w.rS.td = 1; ...
github
qihongl/mathCognition_PDP_RL-master
initParams.m
.m
mathCognition_PDP_RL-master/[past]/sim16.8_hiddenUnits/initParams.m
2,334
utf_8
896ef64bf3aea760f34ae0ae2160a59f
% written by professor Jay McClelland function [] = initParams(epoch) % This program initialize and preallocate the parameters needed for the % model. This should be executed before the simulations. global p a p.teachingStyle = 2; % 1 = final reward only % 2 = intermediate reward % 3 = final reward only + tea...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/[past]/sim16.8_hiddenUnits/updateState.m
1,084
utf_8
1be1d547bea5f33708312d440733ee19
% written by professor Jay McClelland function [ ] = updateState() %this function uses the real state to update the internal state %after Act is called to execute the hand or eye movement action global w h p a; %% compute the relative locations % the relative locations of eye and hand w.vS.eyePos = 0; w.vS....
github
qihongl/mathCognition_PDP_RL-master
initState.m
.m
mathCognition_PDP_RL-master/[past]/sim16.8_hiddenUnits/initState.m
1,564
utf_8
2cbd3d9d9d3194e4cd1bcabe49d8a259
% written by professor Jay McClelland function [ ] = initState( ) global a w h p mode; %% specify the parameters % a.act = zeros(p.mvRange+1,1); a.dfRwd = 0; a.Rwd = 0; w.rS.time = 0; w.rS.td = 0; w.stateNum = -1; % preallocation for activations % a.old.hIn = zeros(p.nHidden,1); % a.old.hAct = zeros(p...
github
qihongl/mathCognition_PDP_RL-master
trainAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim16.8_hiddenUnits/trainAgent.m
1,894
utf_8
d70fec85e52717958ed9a0d491e17f01
%% Trains the network n trials % written by professor Jay McClelland function [record] = trainAgent(epoch, seed) %% initialization % initialize parameters global p a w mode; initParams(epoch); p.seed = seed; rng(seed) progBarLen = 10; % preallocate record.a = cell(1,epoch); s = preallocateScores(epoch); ...
github
qihongl/mathCognition_PDP_RL-master
computeRwd.m
.m
mathCognition_PDP_RL-master/[past]/sim16.8_hiddenUnits/computeRwd.m
2,382
utf_8
ece39cb88c90cfd4bad47960845c3350
function Rwd = computeRwd() %% this function controls the reward policy global w p h a; % if there is remaining items if targetRemain() if a.choice == p.mvRange +1 % saying "done" Rwd = p.r.smallNeg; w.stopEarly = true; w.done = true; elseif a.choice == p.mvRad +1 % not moving ...
github
qihongl/mathCognition_PDP_RL-master
runAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim12_combineTeach/runAgent.m
1,246
utf_8
5e4d1f098e22cf86de2a6ecab8e97796
% written by professor Jay McClelland function [ results ] = runAgent() global a w h p; % rng(seed) % w.seed = seed; %% initialize the state initState(); updateState(); % compute the true answers w.answer = computeAnswer(); %% training the model once i = 0; teachTrial = 0; indices = zeros(1,p.maxIter);...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/[past]/sim12_combineTeach/updateWeights.m
721
utf_8
8553f7c79f7892efa4f60a039b22a6e0
% written by professor Jay McClelland function [ ] = updateWeights() % this function controls: % 1. the reward policy % 2. the weight update % 3. activate the "teaching" global a w p; %% compute the reward values according to the reward policy Rwd = computeRwd(); %% assign the reward values a.Rwd = Rwd; a...
github
qihongl/mathCognition_PDP_RL-master
selectAction.m
.m
mathCognition_PDP_RL-master/[past]/sim12_combineTeach/selectAction.m
722
utf_8
564f4a8eafd6f613fefa938376e1a26c
% written by professor Jay McClelland function [] = selectAction( ) % It computes the output, and choose the action probabilistically. global w a p; %% compute the output activation a.act = a.wts * w.vS.visInput'; % bias toward action 0 (don't move) a.act(p.mvRad + 1) = a.act(p.mvRad + 1) + a.bias; % choose a...
github
qihongl/mathCognition_PDP_RL-master
testing.m
.m
mathCognition_PDP_RL-master/[past]/sim12_combineTeach/testing.m
190
utf_8
00551727050d696efb45a0c7eed98de5
% just testing, a short cut for running the model function testing(epoch) if nargin == 0 epoch = 10; end record = trainAgent(epoch); save('record','record'); % checkDevelop() quiz() end
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/[past]/sim12_combineTeach/showState.m
1,122
utf_8
f34bd313a9d7904b8005de7e702b707c
% written by professor Jay McClelland function [ ] = showState( ) global p w d a; % plot rewards over time axes(d.rax); % if a.Rwd == p.r.smallNeg % color = 'c'; % elseif a.Rwd == p.r.midNeg || a.Rwd == p.r.bigNeg % color = 'b'; % elseif a.Rwd == p.r.midPos % color = 'y'; % elseif a.Rwd == p.r....
github
qihongl/mathCognition_PDP_RL-master
initParams.m
.m
mathCognition_PDP_RL-master/[past]/sim12_combineTeach/initParams.m
1,495
utf_8
110cbcc7d5f909f3f0ad9638efba56ea
% written by professor Jay McClelland function [] = initParams(epoch) % This program initialize and preallocate the parameters needed for the % model. This should be executed before the simulations. global p a %% modeling parameters p.wf = .2; % noise magnitude p.lrate = .01; % learning rate p...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/[past]/sim12_combineTeach/updateState.m
1,042
utf_8
908fc46ea462321cb5bade36501f9a34
% written by professor Jay McClelland function [ ] = updateState() %this function uses the real state to update the internal state %after Act is called to execute the hand or eye movement action global w a h p; %% compute the relative locations % the relative locations of eye and hand w.vS.eyePos = 0; w.vS....
github
qihongl/mathCognition_PDP_RL-master
initState.m
.m
mathCognition_PDP_RL-master/[past]/sim12_combineTeach/initState.m
1,346
utf_8
f5d17e6ac041941df733e964fab3ede9
% written by professor Jay McClelland function [ ] = initState( ) global a w h p; %realState is characterized by the position of a target to touch, %position of eye, and position of hand %in a 101-pixel one-d space %viewedState is the input I have given that my eye and hand are %at particular positions w.r...
github
qihongl/mathCognition_PDP_RL-master
plotResults.m
.m
mathCognition_PDP_RL-master/[past]/sim12_combineTeach/plotResults.m
544
utf_8
da928d22f60607e06a82b5f24fe4b624
function plotResults(record) global d; % initialize the parameters for the plot d.fh = figure(); d.fh.WindowStyle = 'docked'; d.rax = subplot(3,1,1); d.hax = subplot(3,1,2); d.wax = subplot(3,1,3); % d.dtimes = 2.^(10:10); % load('record.mat'); for i = 1 : size(record.r{size(record.r,2)}.h,2) plotRes(i, record); e...
github
qihongl/mathCognition_PDP_RL-master
trainAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim12_combineTeach/trainAgent.m
949
utf_8
73bb1b6fb81e3c6dcea2d70a456f8d26
% written by professor Jay McClelland function [record] = trainAgent(epoch) %% This function trains the network n trials % initialize parameters global p d a; initParams(epoch); % initPlot(); % preallocate record.a = cell(1,epoch); record.steps = nan(1,epoch); % record.indices = cell(1,epoch); % record.com...
github
qihongl/mathCognition_PDP_RL-master
computeRwd.m
.m
mathCognition_PDP_RL-master/[past]/sim12_combineTeach/computeRwd.m
2,411
utf_8
8220c6a9c20be837ce0b2054677ad5e9
function Rwd = computeRwd() %% this function controls the reward policy global w a p; w.actionCorrect = true; % if there is remaining items if targetRemain() % if a.choice == p.mvRad+1 % not moving if w.out.handStep == 0 Rwd = p.r.smallNeg; % if stop too long, also termiante % w.stopC...
github
qihongl/mathCognition_PDP_RL-master
Act.m
.m
mathCognition_PDP_RL-master/[past]/sim12_combineTeach/Act.m
402
utf_8
9240309e992077ffcf3f10b3cc146514
% written by professor Jay McClelland function [ ] = Act( ) % here we act according to the action selected % by selectAction global w; %% perform the actions % update the real locations of hand and eye w.rS.handPos = w.rS.handPos + w.out.handStep; w.rS.eyePos = w.rS.eyePos + w.out.eyeStep; w.rS.td = 1; %...
github
qihongl/mathCognition_PDP_RL-master
runAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim10_forcing/runAgent.m
1,273
utf_8
2b39b01046313d8b18b63684ee0d47d1
% written by professor Jay McClelland function [ results ] = runAgent() global a w h p; % rng(seed) % w.seed = seed; %% initialize the state initState(); updateState(); % compute the true answers w.answer = computeAnswer(w); %% training the model once i = 0; teachTrial = 0; indices = zeros(1,p.maxIter)...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/[past]/sim10_forcing/updateWeights.m
684
utf_8
2a35707770a0830894255d38e3f647ef
% written by professor Jay McClelland function [ ] = updateWeights() % this function controls: % 1. the reward policy % 2. the weight update % 3. activate the "teaching" global a w p; %% compute the reward values according to the reward policy Rwd = computeRwd(); %% assign the reward values a.Rwd = Rwd; a...
github
qihongl/mathCognition_PDP_RL-master
selectAction.m
.m
mathCognition_PDP_RL-master/[past]/sim10_forcing/selectAction.m
725
utf_8
97771aa99d8de06b91a45b864e56e9df
% written by professor Jay McClelland function [] = selectAction( ) % It computes the output, and choose the action probabilistically. global w a p; %% compute the output activation a.act = a.wts * w.vS.visInput'; % bias toward action 0 (don't move) a.act(p.mvRad + 1) = a.act(p.mvRad + 1) + a.bias; % choose a...
github
qihongl/mathCognition_PDP_RL-master
testing.m
.m
mathCognition_PDP_RL-master/[past]/sim10_forcing/testing.m
192
utf_8
ccef1f2affaa5f7136ec4542a7ccd35c
% just testing, a short cut for running the model function testing(epoch) if nargin == 0 epoch = 5000; end record = trainAgent(epoch); save('record','record'); % checkDevelop() quiz() end
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/[past]/sim10_forcing/showState.m
1,122
utf_8
7b511266ea2cd400a15d7791420eecf3
% written by professor Jay McClelland function [ ] = showState( ) global p w d a; % plot rewards over time axes(d.rax); % if a.Rwd == p.r.smallNeg % color = 'c'; % elseif a.Rwd == p.r.midNeg || a.Rwd == p.r.bigNeg % color = 'b'; % elseif a.Rwd == p.r.midPos % color = 'y'; % elseif a.Rwd == p.r....
github
qihongl/mathCognition_PDP_RL-master
initParams.m
.m
mathCognition_PDP_RL-master/[past]/sim10_forcing/initParams.m
1,494
utf_8
81f7a99a0781b30e023eccdaf67a577f
% written by professor Jay McClelland function [] = initParams(epoch) % This program initialize and preallocate the parameters needed for the % model. This should be executed before the simulations. global p a %% modeling parameters p.wf = .2; % noise magnitude p.lrate = .01; % learning rate p...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/[past]/sim10_forcing/updateState.m
1,046
utf_8
faaf159ed3ff215d63ba4a9e6f61cf06
% written by professor Jay McClelland function [ ] = updateState() %this function uses the real state to update the internal state %after Act is called to execute the hand or eye movement action global w a h p; %% compute the relative locations % the relative locations of eye and hand w.vS.eyePos = 0; w.vS....