Home > TNNT_1_07 > FrontEnd > plot_rmse.m

plot_rmse

PURPOSE ^

PLOT_RMSE plots RMSE data on the GUI

SYNOPSIS ^

function plot_rmse(TrainingParams,TrainingResults,TestingResults)

DESCRIPTION ^

PLOT_RMSE plots RMSE data on the GUI

Description:
Function to plot RMSE data on the GUI, both globally and locally, which
the local version having zoom and averaging parameters determined from the
GUI.

Syntax:
PLOT_RMSE(TrainingParams,TrainingResults);
PLOT_EXTRA(TrainingParams,TrainingResults,TestingResults);

Input Parameters:
o TrainingParams: A structure that contains information for training a
    theta neuron network, such as the learning method. This structure is
    generated by get_training_params.
o TrainingResults: A structure containing error gradient with respect to
    the weights (DEDW) and delays (DEDTau).  The structure also includes
    the SSE, NonFireFlag to indicate is any neurons are not firing along
    with NonFireCount, an array used to keep track of how many times a
    neuron has not fired over multiple input patterns.  This structure is
    generated by calculate_gradient. If passed as an input, certain
    results are appended.
o TestingResults: A structure containing results generated on the testing
    data in the same format as TrainingResults.

Output Parameters:
o None

Example:
>> %Assumes valid simulation training results are loaded below
>> GUIHandle=start_ThNN;
>> Temp=get(GUIHandle,'UserData');
>> Handles=Temp{2};
>> cd('Results');
>> [File,PathLoad] = uigetfile('*.mat','Load Simulation...');
>> cd('..');
>> load([PathLoad, File]);
>> TrainingParams.Handles=Handles;
>> set_params(Handles,ThNN,TrainingParams);
>> plot_rmse(TrainingParams,TrainingResults);

See also theta_neuron_network

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plot_rmse(TrainingParams,TrainingResults,TestingResults)
0002 %PLOT_RMSE plots RMSE data on the GUI
0003 %
0004 %Description:
0005 %Function to plot RMSE data on the GUI, both globally and locally, which
0006 %the local version having zoom and averaging parameters determined from the
0007 %GUI.
0008 %
0009 %Syntax:
0010 %PLOT_RMSE(TrainingParams,TrainingResults);
0011 %PLOT_EXTRA(TrainingParams,TrainingResults,TestingResults);
0012 %
0013 %Input Parameters:
0014 %o TrainingParams: A structure that contains information for training a
0015 %    theta neuron network, such as the learning method. This structure is
0016 %    generated by get_training_params.
0017 %o TrainingResults: A structure containing error gradient with respect to
0018 %    the weights (DEDW) and delays (DEDTau).  The structure also includes
0019 %    the SSE, NonFireFlag to indicate is any neurons are not firing along
0020 %    with NonFireCount, an array used to keep track of how many times a
0021 %    neuron has not fired over multiple input patterns.  This structure is
0022 %    generated by calculate_gradient. If passed as an input, certain
0023 %    results are appended.
0024 %o TestingResults: A structure containing results generated on the testing
0025 %    data in the same format as TrainingResults.
0026 %
0027 %Output Parameters:
0028 %o None
0029 %
0030 %Example:
0031 %>> %Assumes valid simulation training results are loaded below
0032 %>> GUIHandle=start_ThNN;
0033 %>> Temp=get(GUIHandle,'UserData');
0034 %>> Handles=Temp{2};
0035 %>> cd('Results');
0036 %>> [File,PathLoad] = uigetfile('*.mat','Load Simulation...');
0037 %>> cd('..');
0038 %>> load([PathLoad, File]);
0039 %>> TrainingParams.Handles=Handles;
0040 %>> set_params(Handles,ThNN,TrainingParams);
0041 %>> plot_rmse(TrainingParams,TrainingResults);
0042 %
0043 %See also theta_neuron_network
0044 
0045 %Copyright (C) 2008 Sam McKennoch <Samuel.McKennoch@loria.fr>
0046 
0047 
0048 Handles=TrainingParams.Handles;
0049 
0050 if nargin==1
0051     Data=get(Handles.axes3,'UserData');
0052     if isempty(Data)
0053         %No Data Has Been Processed Yet...
0054         return;
0055     end
0056     TrainingResults=Data{1};
0057     if length(Data)==2
0058         TestingResults=Data{2};
0059     end
0060 end
0061 
0062 RMSE=TrainingResults.RMSE;
0063 if exist('TestingResults')
0064     TestingRMSE=TestingResults.RMSE;
0065 else
0066     TestingRMSE=[];
0067 end
0068 
0069 ZoomWindow=floor(get(Handles.Zoom_Window,'Value'));
0070 if ~isempty(TestingRMSE) 
0071     plot(Handles.axes4,0:(length(RMSE)-1),RMSE,...
0072         [0 1 TrainingParams.TestingFrequency*(1:(length(TestingRMSE)-2))],TestingRMSE);
0073     legend('Training','Testing');
0074 else
0075     plot(Handles.axes4,0:(length(RMSE)-1),RMSE);
0076 end
0077 grid(Handles.axes4,'on');
0078 Yl=get(Handles.axes4,'YLim');
0079 try %This will fail if the min is negative, in which case auto-scale is ok
0080     set(Handles.axes4,'YLim',[0, min(Yl(2),3e3)]);
0081 end
0082 title(Handles.axes4,'RMSE over all epochs');
0083 
0084 
0085 
0086 if get(Handles.Average,'Value')==1
0087     AveWindow=round(str2num(get(Handles.Averaging_Window,'String')));
0088     RMSETemp=RMSE;
0089     RMSE=conv(RMSETemp,ones(1,AveWindow));
0090     RMSE=RMSE(1:length(RMSETemp));
0091     LG=min((AveWindow-1),length(RMSE));
0092     RMSE(1:LG)=RMSE(1:LG)./(1:LG);
0093     RMSE(AveWindow:end)=RMSE(AveWindow:end)/AveWindow;
0094 end
0095 
0096 if ~isempty(TestingRMSE) 
0097     plot(Handles.axes3,0:(length(RMSE)-1),RMSE,...
0098             [0 1 TrainingParams.TestingFrequency*(1:(length(TestingRMSE)-2))],TestingRMSE);
0099     legend(Handles.axes3,'Training','Testing');
0100 else
0101     plot(Handles.axes3,0:(length(RMSE)-1),RMSE);
0102 end
0103 grid(Handles.axes3,'on');
0104 Yl=get(Handles.axes3,'YLim');
0105 try
0106     if length(RMSE)>ZoomWindow
0107         set(Handles.axes3,'YLim',[max(min(RMSE((length(RMSE)-ZoomWindow):length(RMSE))),0), min(max(RMSE((length(RMSE)-ZoomWindow):length(RMSE))),4e4)]);
0108     end
0109 end
0110 Xl=get(Handles.axes3,'XLim');
0111 set(Handles.axes3,'XLim',[max(length(RMSE)-ZoomWindow,0), Xl(2)]);
0112 title(Handles.axes3,'MSE over recent epochs');
0113 
0114 drawnow;
0115 
0116 %Save For Possible Action Between Diplay/Testing Frequency
0117 if ~isempty(TestingRMSE)
0118     Data={TrainingResults TestingResults};
0119 else
0120     Data={TrainingResults};
0121 end
0122 set(Handles.axes3,'UserData',Data);

Generated on Wed 02-Apr-2008 15:16:32 by m2html © 2003