⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_rnn3.m

📁 这是个神经网络工具箱的一点MATALAB 程序
💻 M
字号:
%   File Name      : test_rnn3
%   Purpose        : Testing the trained RNN
%   Author         : Hossam E. Mostafa Abdelbaki, School of Computer Science, 
%                    University of Centeral Florida (UCF). 
%   Release        : ver. 1.0.
%   Date           : October 1998.
%
%       RNNSIM is a software program available to the user without any 
%   license or royalty fees. Permission is hereby granted to use, copy, 
%   modify, and distribute this software for any purpose. The Author 
%   and UCF give no warranty, express, implied, or statuary for the 
%   software including, without limitation, waranty of merchantibility 
%   and warranty of fitness for a particular purpose. The software 
%   provided hereunder is on an "as is"  basis, and the Author and the 
%   UCF has no obligation to provide maintenance, support, updates, 
%   enhancements, or modifications. 
%
%       RNNSIM  is available for any platform (UNIX, PCWIN, MACHITOCH). 
%   It runs under MATLAB ver. 5.0 or highrer. 
%
%       User feedback, bugs, or software and manual suggestions can 
%   be sent via electronic mail to :   ahossam@cs.ucf.edu

%%%%%%%%%%%    FUNCTION: test_rnn3.m    %%%%%%%%%%%%
     
Temp_Log_File_Name = '';
for i = 1:length(Log_File_Name)
    if(Log_File_Name(i) ~= '.')
       Temp_Log_File_Name(i) = Log_File_Name(i);
    else 
       break   
    end
 end
 Temp_Log_File_Name(i) = '.';
 Temp_Log_File_Name(i+1) = 'm';
 
 if(Save_Weights == 1 & strcmp(Weights_File_Name,Temp_Weights_File_Name) ~=1 )
    mess = sprintf('load %s wplus wminus last_iter last_elapsed_time err MSEaveg',...
       Weights_File_Name);
    eval(mess);
 else
    mess = sprintf('load %s wplus wminus last_iter last_elapsed_time err MSEaveg',...
       Temp_Weights_File_Name);
    eval(mess);
 end   
fid = fopen(Log_File_Name,'w');
fprintf(fid,'Iteration No.  %d      MSE = %12.9f \n',last_iter, MSEaveg);
fprintf(fid,'--------------------------------------------\n');

for k = 1:N_Test_Patterns   
   calc_rate;
   calc_output;
   
   q_cal=[];
   for i=(N_Input+N_Hidden+1):N_Total
      q_cal = [q_cal q(i)];
   end
   
   %%%%%%%%%%% Printing the results %%%%%%%%%%%%%
   mess = sprintf('Pattern No. %d ',k);
   fprintf(fid,'pattern No. %d: \n',k);
   for i=1:N_Input
      fprintf(fid,'%6.4f ',TEST_INPUT(k,i));
   end
   fprintf(fid,'\n Response: \n');
   for i = 1:N_Output
      fprintf(fid,'%6.4f ',q_cal(i));
   end
   fprintf(fid,'\n\n');       
end %for
fclose(fid);

fid = fopen(Temp_Log_File_Name,'w');
fprintf(fid,'%%Iteration No.  %d      MSE = %f \n',last_iter, MSEaveg);
fprintf(fid,'%%--------------------------------------------\n');
fprintf(fid,'RESPONSE = [\n');
for k = 1:N_Test_Patterns   
   calc_rate;
   calc_output;
   
   q_cal=[];
   for i=(N_Input+N_Hidden+1):N_Total
      q_cal = [q_cal q(i)];
   end
   
   %%%%%%%%%%% Printing the results %%%%%%%%%%%%%
   for i = 1:N_Output
      fprintf(fid,'%6.4f ',q_cal(i));
   end
   fprintf(fid,'\n');       
end %for
fprintf(fid,'];\n');
fclose(fid);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -