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
computeRwd.m
.m
mathCognition_PDP_RL-master/sim23.0_count/computeRwd.m
2,905
utf_8
d4cae137f57b8cafdbb80b73dbc972c3
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.action == p.mvRange +1 % saying "done" Rwd = p.r.smallNeg; w.errors = w.errors + 1; w.done = true; elseif a.action == p...
github
qihongl/mathCognition_PDP_RL-master
runAgent.m
.m
mathCognition_PDP_RL-master/sim21.3_hidden_targ/runAgent.m
1,116
utf_8
fd6b1cdf0b65e1968929bf8e59d43f6c
% written by professor Jay McClelland function [ results ] = runAgent() global a w h p mode; %% initialize the state initState(); updateState(); computeAnswer(); % compute the true 'answers' %% train the model once t = 0; indices = zeros(1,p.maxIter); while ~(w.done) && t < p.maxIter %% choose act...
github
qihongl/mathCognition_PDP_RL-master
trainOne.m
.m
mathCognition_PDP_RL-master/sim21.3_hidden_targ/trainOne.m
764
utf_8
da63d60804f0250e07bd5b277c73438f
% 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([saveDir...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/sim21.3_hidden_targ/updateWeights.m
3,224
utf_8
6ac0e5327b5d806faf5a2738ef99bd08
% 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/sim21.3_hidden_targ/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/sim21.3_hidden_targ/initParams.m
4,193
utf_8
a6d1469d87ffef51350b0502be9a6178
% 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 buffer %% teaching strategy % if teaching style is specified here, then trainGroup will use this % va...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/sim21.3_hidden_targ/updateState.m
1,137
utf_8
b7f489fdff68b16f52c2b5336d86ef59
% 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/sim21.3_hidden_targ/initState.m
1,609
utf_8
31fd190a63510d233a4f7fadf964e080
% 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/sim21.3_hidden_targ/updateBuffer.m
1,427
utf_8
d34f7ab9c772aa1e53a37f5420bf6604
%% 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/sim21.3_hidden_targ/trainAgent.m
1,906
utf_8
66fb53004cf839722aceb5326c612ef8
%% 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/sim21.3_hidden_targ/computeExpectedReward.m
840
utf_8
4bc9236135238e3ac1ded9a2234e8990
%% 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: dfRw...
github
qihongl/mathCognition_PDP_RL-master
xorModel.m
.m
mathCognition_PDP_RL-master/demo_nn/xorModel.m
2,382
utf_8
d9f345d48799c58909cf91f218172c57
function [r] = xorModel() % XOR input for x1 and x2 input = [0 0; 0 1; 1 0; 1 1]; % Desired output of XOR output = [0;1;1;0]; % Initialize the bias bias = [-1 -1 -1]; % Learning coefficient p.lrate = 0.7; % Number of learning p.epochs p.epochs = 100; % Calculate weights randomly using seed. rand('state',sum...
github
qihongl/mathCognition_PDP_RL-master
nnCostFunction.m
.m
mathCognition_PDP_RL-master/demo_nn/nnCostFunction.m
2,476
utf_8
75b1b1dffb03e5bf83082b319af6104c
%NNCOSTFUNCTION Implements the neural network cost function for a two layer %neural network which performs classification % [J grad] = NNCOSTFUNCTON(nn_params, hidden_layer_size, num_labels, ... % X, y, lambda) computes the cost and gradient of the neural network. The % parameters for the neural network are "unro...
github
qihongl/mathCognition_PDP_RL-master
submit.m
.m
mathCognition_PDP_RL-master/demo_nn/submit.m
17,129
utf_8
90fe6bfd432e59c0a145fb1240d34ce5
function submit(partId, webSubmit) %SUBMIT Submit your code and output to the ml-class servers % SUBMIT() will connect to the ml-class server and submit your solution fprintf('==\n== [ml-class] Submitting Solutions | Programming Exercise %s\n==\n', ... homework_id()); if ~exist('partId', 'var') || isem...
github
qihongl/mathCognition_PDP_RL-master
submitWeb.m
.m
mathCognition_PDP_RL-master/demo_nn/submitWeb.m
827
utf_8
bfb2fa08cac9d8d797e3071d3fdd7ca1
% submitWeb Creates files from your code and output for web submission. % % If the submit function does not work for you, use the web-submission mechanism. % Call this function to produce a file for the part you wish to submit. Then, % submit the file to the class servers using the "Web Submission" button on ...
github
qihongl/mathCognition_PDP_RL-master
runAgent.m
.m
mathCognition_PDP_RL-master/sim21.0_replay/runAgent.m
907
utf_8
ae308f723ec1df810d6ad2f5f3df1bc7
% written by professor Jay McClelland function [ results ] = runAgent() global a w h p mode; %% initialize the state initState(); updateState(); computeAnswer(); % compute the true 'answers' %% train the model once t = 0; indices = zeros(1,p.maxIter); while ~(w.done) && t < p.maxIter %% choose act...
github
qihongl/mathCognition_PDP_RL-master
trainOne.m
.m
mathCognition_PDP_RL-master/sim21.0_replay/trainOne.m
763
utf_8
baf2c9aac6e263a6101d0dce66c2996a
% just testing, a short cut for running the model function record = trainOne(epoch, seed) clear global if nargin == 0 epoch = 1000; seed = randi(99); % seed = 66 end %% run the simulation global p record = trainAgent(epoch, seed); % save the simulation results saveDirName = getSaveDir(); save([saveDirN...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/sim21.0_replay/updateWeights.m
2,844
utf_8
5c90cbc7f20dbcd6a3d39fa03b26e417
% 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/sim21.0_replay/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/sim21.0_replay/initParams.m
3,828
utf_8
10b38cae3dd90afd0b9ddcdf6c8eeceb
% 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 buffer %% teaching strategy % if teaching style is specified here, then trainGroup will use this % va...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/sim21.0_replay/updateState.m
1,137
utf_8
b7f489fdff68b16f52c2b5336d86ef59
% 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/sim21.0_replay/initState.m
1,609
utf_8
31fd190a63510d233a4f7fadf964e080
% 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/sim21.0_replay/updateBuffer.m
1,427
utf_8
d34f7ab9c772aa1e53a37f5420bf6604
%% 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/sim21.0_replay/trainAgent.m
1,902
utf_8
b4895d68c7528dd8540d75068bcfdd51
%% 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/sim21.0_replay/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
runAgent.m
.m
mathCognition_PDP_RL-master/sim20.2_scaleRwd/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/sim20.2_scaleRwd/trainOne.m
599
utf_8
4926604e370b5eb40f082b7036b14f53
% 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/sim20.2_scaleRwd/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/sim20.2_scaleRwd/updateWeights.m
1,063
utf_8
00b5be7d5e214190466fa20d91795aea
% 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(); % if reward == -1, do sth diff a.act_next...
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/sim20.2_scaleRwd/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/sim20.2_scaleRwd/initParams.m
2,284
utf_8
fb61794ed6079bc1bcc6f9fb35ec1de7
% 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 + t...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/sim20.2_scaleRwd/updateState.m
1,137
utf_8
b7f489fdff68b16f52c2b5336d86ef59
% 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/sim20.2_scaleRwd/initState.m
1,665
utf_8
4089ab3033ac759bf8c9857f7d1932f2
% 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/sim20.2_scaleRwd/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
quiz.m
.m
mathCognition_PDP_RL-master/testModel/quiz.m
862
utf_8
dbf78073f269b978120d7c8fef51a76a
%% This is a quiz for the model % It come up with N questions and record the performance of the model function finalScore = quiz(showPlot) if nargin == 0 showPlot = false; end %% Parameters dfNumQs = 50; dfNumPlots = 1; %% Get data from the current directory filename = 'record.mat'; datapath = [pwd '/' filename];...
github
qihongl/mathCognition_PDP_RL-master
testModel.m
.m
mathCognition_PDP_RL-master/testModel/testModel.m
1,269
utf_8
dd32d0c9a12ea4543bd2f59f5ab242ab
%% An little quiz for the model % this function takes a set of trained weights and parameters, come up with % a counting question, let the model do the counting, and records its % performance! So it is in some sense a little quiz for the model. function [score] = testModel(showPlot, nItem) global p a w mode; setTestMo...
github
qihongl/mathCognition_PDP_RL-master
evaluateModel_quiz.m
.m
mathCognition_PDP_RL-master/testModel/evaluateModel_quiz.m
5,960
utf_8
122331f697e460f401dfcda6fd889f10
function [finalScore] = evaluateModel_quiz( score, numQs, showResults) if nargin < 3 showResults = true; end % This function assume the data is the quiz data % Namely, the input data can be converted to "cardinality X numQs matrix" global p; if numel(score) ~= p.maxItems * numQs error('Size of the data is ...
github
qihongl/mathCognition_PDP_RL-master
averagingWts.m
.m
mathCognition_PDP_RL-master/testModel/averagingWts.m
907
utf_8
1a61b1cc8274b64f6db55a545f6e70e8
% take average of the weights function averagingWts() global p; FONTSIZE = 14; NSUBJ = 20; NAME = 'record'; %% get the weights wts = cell(NSUBJ,1); for i = 1 : NSUBJ filename = sprintf('%s%.2d.mat', NAME, i); load(filename); wts{i} = record.a.wts; end p = record.p; %% averaging the weights meanWts = zeros...
github
qihongl/mathCognition_PDP_RL-master
getFilenames.m
.m
mathCognition_PDP_RL-master/testModel/getFilenames.m
325
utf_8
d37407a050a3e5b0e8b18787e1159998
%% get file names for all file, so that I can target them function filenames = getFilenames(filename, nSubj) % specify the format of the file format = '.mat'; % create all file name filenames = cell(nSubj,1); % create all the file name for n = 1 : nSubj filenames{n} = sprintf(['%s%.2d' format], filename, n); end...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/testModel/old/updateWeights.m
830
utf_8
abe33ad8c85510746a004a1a18f50d60
% written by professor Jay McClelland function [ ] = updateWeights( ) global a w p; %% Assign the reward values % if the hand is touching a item, and that item is untouched before if any(w.rS.handPos == w.rS.targPos) && (w.rS.targRemain(w.rS.handPos == w.rS.targPos) == true) w.rS.targRemain(w.rS.targPos =...
github
qihongl/mathCognition_PDP_RL-master
selectAction.m
.m
mathCognition_PDP_RL-master/testModel/old/selectAction.m
778
utf_8
26808e8e7b2ba2af3c3f796360d7b127
% 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/testModel/old/showState.m
710
utf_8
868e49a6bc76a8f2db42ea01f6091847
% written by professor Jay McClelland function [ ] = showState( ) global p w d a; axes(d.rax); plot(w.rS.time,a.Rwd,'-*'); hold on; ylim(d.rax,[-0.1 1.1]); xlim(d.rax,[-0.25,w.rS.time+0.25]); t = w.rS.time; % plot the history of eye and hand positions axes(d.hax); plot(d.hax,[-p.spRad p.spRad],[t t]); hold...
github
qihongl/mathCognition_PDP_RL-master
initParamsEtc.m
.m
mathCognition_PDP_RL-master/testModel/old/initParamsEtc.m
1,091
utf_8
69772c75f6cc6fe51c89b61450d7ce3f
% written by professor Jay McClelland function [] = initParamsEtc( ) % This program initialize and preallocate the parameters needed for the % model. This should be executed before the simulations. global p d a %% modeling parameters p.wf = .2; % noise magnitude p.lrate = .1; % learning rate ...
github
qihongl/mathCognition_PDP_RL-master
choose.m
.m
mathCognition_PDP_RL-master/testModel/old/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/testModel/old/updateState.m
1,025
utf_8
17a84148d48a20188df31db95a4f09ab
% 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; %% compute the relative locations % the relative locations of eye and hand w.vS.eyePos = 0; w.v...
github
qihongl/mathCognition_PDP_RL-master
initState.m
.m
mathCognition_PDP_RL-master/testModel/old/initState.m
1,438
utf_8
7d557634047b25efd393a78b171c94da
% 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
Act.m
.m
mathCognition_PDP_RL-master/testModel/old/Act.m
404
utf_8
c8ce5a2f3bcdf3fa4195dafad94f8e76
% written by professor Jay McClelland function [ ] = Act( ) % here we act according to the action selected % by selectAction global w p; %% 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/sim20.1_simplify/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/sim20.1_simplify/trainOne.m
599
utf_8
4926604e370b5eb40f082b7036b14f53
% 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/sim20.1_simplify/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/sim20.1_simplify/updateWeights.m
789
utf_8
3669dc6b40fe43a73900b9e88a5abf88
% 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(); % if reward == -1, do sth diff a.act_next...
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/sim20.1_simplify/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/sim20.1_simplify/initParams.m
2,308
utf_8
a404e821f49168803c171ca3ba039bb7
% 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 + t...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/sim20.1_simplify/updateState.m
1,137
utf_8
b7f489fdff68b16f52c2b5336d86ef59
% 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/sim20.1_simplify/initState.m
1,609
utf_8
31fd190a63510d233a4f7fadf964e080
% 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/sim20.1_simplify/trainAgent.m
1,836
utf_8
f872b2318f4a2b603a383a725db112c5
%% 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
runAgent.m
.m
mathCognition_PDP_RL-master/sim21.2_targetNet/runAgent.m
1,097
utf_8
0a7909b39dd7dae2f4ed5cc01985a057
% written by professor Jay McClelland function [ results ] = runAgent() global a w h p mode; %% initialize the state initState(); updateState(); computeAnswer(); % compute the true 'answers' %% train the model once t = 0; indices = zeros(1,p.maxIter); while ~(w.done) && t < p.maxIter %% choose act...
github
qihongl/mathCognition_PDP_RL-master
trainOne.m
.m
mathCognition_PDP_RL-master/sim21.2_targetNet/trainOne.m
761
utf_8
baa37569ccd3dbfe38bfa11d25118de2
% just testing, a short cut for running the model function record = trainOne(epoch, seed) clear global if nargin == 0 epoch = 1000; seed = randi(99); seed = 66 end %% run the simulation global p record = trainAgent(epoch, seed); % save the simulation results saveDirName = getSaveDir(); save([saveDirNam...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/sim21.2_targetNet/updateWeights.m
2,572
utf_8
24b42412fb538cfefef1b124761fbbad
% 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 %% experienc...
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/sim21.2_targetNet/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/sim21.2_targetNet/initParams.m
4,034
utf_8
edc8c0b7df81fb09e9b8ff2ff477eb2a
% 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 buffer %% teaching strategy % if teaching style is specified here, then trainGroup will use this % va...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/sim21.2_targetNet/updateState.m
1,137
utf_8
b7f489fdff68b16f52c2b5336d86ef59
% 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/sim21.2_targetNet/initState.m
1,609
utf_8
31fd190a63510d233a4f7fadf964e080
% 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/sim21.2_targetNet/updateBuffer.m
1,429
utf_8
0f703ddb26cf30fa6a992dfeb79fcde6
%% 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/sim21.2_targetNet/trainAgent.m
2,003
utf_8
3a7ed21f730accecdb1f79fcbcaf4da5
%% 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/sim21.2_targetNet/computeExpectedReward.m
916
utf_8
ccb6ec148b459c76de3fda938957ce9b
%% 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
computeRwd.m
.m
mathCognition_PDP_RL-master/sim21.2_targetNet/computeRwd.m
2,738
utf_8
4db26f71f0f52e8ae38d3eef7f261097
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 == p...
github
qihongl/mathCognition_PDP_RL-master
runAgent.m
.m
mathCognition_PDP_RL-master/sim21.1_hiddenUnits/runAgent.m
907
utf_8
ae308f723ec1df810d6ad2f5f3df1bc7
% written by professor Jay McClelland function [ results ] = runAgent() global a w h p mode; %% initialize the state initState(); updateState(); computeAnswer(); % compute the true 'answers' %% train the model once t = 0; indices = zeros(1,p.maxIter); while ~(w.done) && t < p.maxIter %% choose act...
github
qihongl/mathCognition_PDP_RL-master
trainOne.m
.m
mathCognition_PDP_RL-master/sim21.1_hiddenUnits/trainOne.m
764
utf_8
da63d60804f0250e07bd5b277c73438f
% 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([saveDir...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/sim21.1_hiddenUnits/updateWeights.m
3,029
utf_8
e2b08dbb44c4da518c2e64c92fe81047
% 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/sim21.1_hiddenUnits/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/sim21.1_hiddenUnits/initParams.m
4,039
utf_8
6e227c3a8ebfc29ab41df9abd3be0bc0
% 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 buffer %% teaching strategy % if teaching style is specified here, then trainGroup will use this % va...
github
qihongl/mathCognition_PDP_RL-master
computeFutureReward.m
.m
mathCognition_PDP_RL-master/sim21.1_hiddenUnits/computeFutureReward.m
828
utf_8
6577937c9a9f1142c512ac63bc28f977
%% 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: dfRw...
github
qihongl/mathCognition_PDP_RL-master
updateState.m
.m
mathCognition_PDP_RL-master/sim21.1_hiddenUnits/updateState.m
1,137
utf_8
b7f489fdff68b16f52c2b5336d86ef59
% 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/sim21.1_hiddenUnits/initState.m
1,609
utf_8
31fd190a63510d233a4f7fadf964e080
% 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/sim21.1_hiddenUnits/updateBuffer.m
1,427
utf_8
d34f7ab9c772aa1e53a37f5420bf6604
%% 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/sim21.1_hiddenUnits/trainAgent.m
1,906
utf_8
66fb53004cf839722aceb5326c612ef8
%% 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
runAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim14_cdf/runAgent.m
1,306
utf_8
9bd9dc658681053014613a896d037422
% written by professor Jay McClelland function [ results ] = runAgent() global a w h p; % 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) && i <...
github
qihongl/mathCognition_PDP_RL-master
updateWeights.m
.m
mathCognition_PDP_RL-master/[past]/sim14_cdf/updateWeights.m
706
utf_8
53448a755be732aa3a23ac74686795a2
% 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; % ...
github
qihongl/mathCognition_PDP_RL-master
testing.m
.m
mathCognition_PDP_RL-master/[past]/sim14_cdf/testing.m
260
utf_8
1e6564b3a7d8940acac43f80ac5f4041
% just testing, a short cut for running the model function testing(epoch) if nargin == 0 epoch = 5000; end record = trainAgent(epoch); save('record','record'); % eval the performance quiz() checkLearning() beep % notice me that the program was ended end
github
qihongl/mathCognition_PDP_RL-master
move.m
.m
mathCognition_PDP_RL-master/[past]/sim14_cdf/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]/sim14_cdf/initParams.m
1,546
utf_8
a71df9726fde6a9c34d1bab8683a1c24
% 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 = .1; % noise magnitude p.lrate = .001; % learning rate ...
github
qihongl/mathCognition_PDP_RL-master
computeRwd2.m
.m
mathCognition_PDP_RL-master/[past]/sim14_cdf/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]/sim14_cdf/updateState.m
947
utf_8
a76d60828bd889a9f748bff77920560c
% 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; %% compute the relative locations % the relative locations of eye and hand w.vS.eyePos = 0; w.vS.ha...
github
qihongl/mathCognition_PDP_RL-master
initState.m
.m
mathCognition_PDP_RL-master/[past]/sim14_cdf/initState.m
1,334
utf_8
4a0d05bf9ec01af0022c21f64c972170
% 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 1-d space %viewedState is the input I have given that my eye and hand are %at particular positions w.r.t. the realState o...
github
qihongl/mathCognition_PDP_RL-master
plotResults.m
.m
mathCognition_PDP_RL-master/[past]/sim14_cdf/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]/sim14_cdf/trainAgent.m
1,198
utf_8
68355bc92e8d3b406dafd1e184e4cbdb
% written by professor Jay McClelland function [record] = trainAgent(epoch) %% This function trains the network n trials % initialize parameters global p a w; initParams(epoch); % preallocate record.a = cell(1,epoch); record.s.steps = nan(1,epoch); record.s.indices = cell(1,epoch); record.s.completed = fals...
github
qihongl/mathCognition_PDP_RL-master
computeRwd.m
.m
mathCognition_PDP_RL-master/[past]/sim14_cdf/computeRwd.m
2,610
utf_8
10c26b1fe0767fa60553b9a7741014f2
function Rwd = computeRwd() %% this function controls the reward policy global w p h; w.actionCorrect = true; % if there is remaining items if targetRemain() if w.out.handStep == 0 % not moving Rwd = p.r.smallNeg; % if stop too long, also termiante % if h(w.stateNum).w.out.handStep == 0...
github
qihongl/mathCognition_PDP_RL-master
runAgent.m
.m
mathCognition_PDP_RL-master/[past]/sim17.2_tanh/runAgent.m
1,376
utf_8
5c6c39d68b7ef942d3454ecd87566f56
% 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]/sim17.2_tanh/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]/sim17.2_tanh/updateWeights.m
1,080
utf_8
54f24f733fa17794774cc8bc65757296
% 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*tanh(a.wts_VH * w.vS....
github
qihongl/mathCognition_PDP_RL-master
showState.m
.m
mathCognition_PDP_RL-master/[past]/sim17.2_tanh/showState.m
1,317
utf_8
5f98a0c96bcf734cfce4abd1d109c314
% 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]/sim17.2_tanh/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]/sim17.2_tanh/initParams.m
2,508
utf_8
4d8bf4632a030e580aac329e072347f8
% 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 = 3; % 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]/sim17.2_tanh/updateState.m
924
utf_8
84c86d58e1b29b01ec1c1a3fad73c7c1
% 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; %% compute the relative locations % the relative locations of eye and hand w.vS.eyePos = 0; w.vS.hand...
github
qihongl/mathCognition_PDP_RL-master
initState.m
.m
mathCognition_PDP_RL-master/[past]/sim17.2_tanh/initState.m
1,630
utf_8
33299d877a4234e89c16dee856064680
% 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]/sim17.2_tanh/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]/sim17.2_tanh/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]/sim17.2_tanh/computeRwd.m
2,205
utf_8
8cad5b2bcbe004359ae289b13c3b08d7
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]/sim22.0_touchInput/runAgent.m
935
utf_8
f8aa34d17d840c50bd4e81973476c2c5
% written by professor Jay McClelland function [ results ] = runAgent() global a w h p mode; %% initialize the state initState(); updateState(); % compute the true answers, for teacher demonstration computeAnswer(); %% train the model once t = 0; indices = zeros(1,p.maxIter); while ~(w.done) && t < ...