DISPLAY_RESULTS displays the desired and actual spike times Description: Function to display the actual and desired spike times to the Matlab command window. Syntax: DISPLAY_RESULTS(ThNN,Mode,Input,tdAll,[tiOrder]); Input Parameters: o ThNN: An object of the theta neuron network class o Mode: A string with possible values 'Inputs' or 'Outputs'. If the string is 'Inputs', then Inputsis interpreted to be input spike times, from which the output spike times must be calculated. If Mode is 'Outputs' then Inputs is interpreted to be output spike times. o Input: Either a cell array of length NumNeurons containing in each cell an array of length r_j of neuron j's output spike times (This format is the one produced from the run_network function) or a cell array of length a, the number of input patterns, of which each cell is a qx2 array that contains the neuron indices for each spike time and the input spike times (q may vary from cell to cell). See Mode above. o tdAll: A cell array of length a, the number of input patterns, of which each cell is a (qo x 2) array that contains the output neuron indices for each desired output spike time and the desired output spike times. qo may vary from cell to cell. o tiOrder: Optional input array containing the order in which the input patterns were processed during this epoch. The order is random when using online learning. Output Parameters: o N/A Examples: >> %Display from input spike times >> ThNN = theta_neuron_network; >> display_results(ThNN, 'Inputs', {[2 3], [2 6]}, {[3 25], [3 20]}); >> %Display from output spike times >> ThNN = theta_neuron_network; >> ts{1} = run_network(ThNN, [2 3]); >> ts{2} = run_network(ThNN, [2 6]); >> display_results(ThNN, 'Outputs', ts, {[3 25], [3 20]}); See also theta_neuron_network
0001 %DISPLAY_RESULTS displays the desired and actual spike times 0002 % 0003 %Description: 0004 %Function to display the actual and desired spike times to the Matlab 0005 %command window. 0006 % 0007 %Syntax: 0008 %DISPLAY_RESULTS(ThNN,Mode,Input,tdAll,[tiOrder]); 0009 % 0010 %Input Parameters: 0011 %o ThNN: An object of the theta neuron network class 0012 %o Mode: A string with possible values 'Inputs' or 'Outputs'. If the string 0013 % is 'Inputs', then Inputsis interpreted to be input spike times, from 0014 % which the output spike times must be calculated. If Mode is 'Outputs' 0015 % then Inputs is interpreted to be output spike times. 0016 %o Input: Either a cell array of length NumNeurons containing in each cell 0017 % an array of length r_j of neuron j's output spike times (This format 0018 % is the one produced from the run_network function) or a cell array of 0019 % length a, the number of input patterns, of which each cell is a qx2 0020 % array that contains the neuron indices for each spike time and the 0021 % input spike times (q may vary from cell to cell). See Mode above. 0022 %o tdAll: A cell array of length a, the number of input patterns, of which 0023 % each cell is a (qo x 2) array that contains the output neuron indices 0024 % for each desired output spike time and the desired output spike times. 0025 % qo may vary from cell to cell. 0026 %o tiOrder: Optional input array containing the order in which the input 0027 % patterns were processed during this epoch. The order is random when 0028 % using online learning. 0029 % 0030 %Output Parameters: 0031 %o N/A 0032 % 0033 %Examples: 0034 %>> %Display from input spike times 0035 %>> ThNN = theta_neuron_network; 0036 %>> display_results(ThNN, 'Inputs', {[2 3], [2 6]}, {[3 25], [3 20]}); 0037 % 0038 %>> %Display from output spike times 0039 %>> ThNN = theta_neuron_network; 0040 %>> ts{1} = run_network(ThNN, [2 3]); 0041 %>> ts{2} = run_network(ThNN, [2 6]); 0042 %>> display_results(ThNN, 'Outputs', ts, {[3 25], [3 20]}); 0043 % 0044 %See also theta_neuron_network 0045 0046 %Copyright (C) 2008 Sam McKennoch <Samuel.McKennoch@loria.fr> 0047 0048 0049 function display_results(ThNN,Mode,Input,tdAll,tiOrder) 0050 0051 if nargin==4 0052 tiOrder=1:length(tdAll); 0053 end 0054 if nargin<4 0055 disp('Error in display_results: Not enough input arguements'); 0056 disp(['Needed at least 4 inputs but only got ' num2str(nargin)]); 0057 return; 0058 end 0059 0060 if strcmp(Mode,'Inputs') 0061 tiAll=Input; 0062 else 0063 tsAll=Input; 0064 end 0065 0066 %If ts is not, but rather tiAll instead, make sure we can handle this... 0067 0068 for k=1:length(tiOrder) 0069 if strcmp(Mode,'Inputs') 0070 ti=tiAll{tiOrder(k)}; 0071 ts = run_network(ThNN,ti); 0072 else 0073 ts = tsAll{tiOrder(k)}; 0074 end 0075 td=tdAll{k}; 0076 0077 OutputNeurons=get_output_neurons(ThNN); 0078 0079 disp('Desired Firing Times: '); 0080 for j=1:length(OutputNeurons) 0081 disp(['Neuron ', num2str(OutputNeurons(j)), ': ', num2str(sort(td(find(td(:,1)==OutputNeurons(j)),2)'))]); 0082 end 0083 disp('Actual Firing Times: '); 0084 for j=1:length(OutputNeurons) 0085 disp(['Neuron ', num2str(OutputNeurons(j)), ': ', num2str(ts{OutputNeurons(j)})]); 0086 end 0087 end