📄 basicsurprisegraph.m.svn-base
字号:
%BASICSURPRISEGRAPH create a basic graph of surprise given the input values
% X = BASICSURPRISEGRAPH(SURPRISE,DATA,SURPRISELABEL,DATALABEL,TITLE,SMOD)
%
% This is an aux. function to create a graph of the surprise output given
% the data input. It is generalized here so that it can be called more
% easily from within runsm.m and other functions that might need to graph
% surprise.
%
% SURPRISE This is the surprise output data
%
% DATA This is the raw input data
%
% SURPRISELABEL This is the label to apply to the surprise data in the
% graph
%
% DATALABEL This is the label to apply to the raw data in the graph
%
% TITLE This will be the graph title
%
% SMOD This is the current surprise model with options. See newsm.m
%
% See also: newalphabeta, runsm, klgamma, graphkl, gamma, psi, digamma, eulermasch
%
% T. Nathan Mundhenk
% mundhenk@usc.edu
%
% //////////////////////////////////////////////////////////////////// %
% The Baysian Surprise Matlab Toolkit - Copyright (C) 2004-2007 %
% by the University of Southern California (USC) and the iLab at USC. %
% See http://iLab.usc.edu for information about this project. %
% //////////////////////////////////////////////////////////////////// %
% This file is part of the Baysian Surprise Matlab Toolkit %
% %
% The Baysian Surprise Matlab Toolkit is free software; you can %
% redistribute it and/or modify it under the terms of the GNU General %
% Public License as published by the Free Software Foundation; either %
% version 2 of the License, or (at your option) any later version. %
% %
% The Baysian Surprise Matlab Toolkit is distributed in the hope %
% that it will be useful, but WITHOUT ANY WARRANTY; without even the %
% implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR %
% PURPOSE. See the GNU General Public License for more details. %
% %
% You should have received a copy of the GNU General Public License %
% along with the iBaysian Surprise Matlab Toolkit; if not, write %
% to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, %
% Boston, MA 02111-1307 USA. %
% //////////////////////////////////////////////////////////////////// %
%
% Primary maintainer for this file: T. Nathan Mundhenk <mundhenk@usc.edu>
%
function X = basicsurprisegraph(surprise,data,surpriseLabel,dataLabel,Title,smod)
scale = (1:1:size(data,1));
topdat = max(max(data));
if strcmp(smod.options.jointmodel,'none')
graphtop = max(max([max(max(real(surprise))) max(max(data))]));
graphbottom = min(min([min(min(real(surprise))) min(min(data))]));
topsup = max(max(real(surprise)));
if smod.dim == 1
plot(scale,surprise,'-.',scale,data,'-.');
elseif smod.dim == 2
plot(scale,surprise(:,1),'b-.',scale,data(:,1),'g-.',scale,surprise(:,2),'b-',scale,data(:,2),'g-');
else
fprintf('WARNING: Graphing does not support dim of size %d. Graph not created\n',smod.dim);
end
else
graphtop = max(max([max(max(real(smod.joint.surprise))) max(max(data))]));
graphbottom = min(min([min(min(real(smod.joint.surprise))) min(min(data))]));
topsup = max(max(real(smod.joint.surprise)));
plot(scale,smod.joint.surprise,'-.',scale,data,'-.');
end
text(1,topsup - 1,surpriseLabel,'fontsize',18,'HorizontalAlignment','left','BackgroundColor',[0.0 0.0 1.0]);
text(1,topdat - 1,dataLabel ,'fontsize',18,'HorizontalAlignment','left','BackgroundColor',[0.0 1.0 0.0]);
xlabel('Time','fontsize',18);
ylabel(surpriseLabel,'fontsize',18);
if strcmp(Title,'setbetamax')
title(['Surprise Values with decay \zeta = ', num2str(smod.decay), ' and update on \beta = ', num2str(smod.updatefac), ...
' Using \beta\prime max = ', num2str(smod.beta2)],'fontsize',18);
elseif strcmp(Title,'factordecay')
title(['Surprise Values with decay \zeta = ', num2str(smod.decay), ' and update on \beta = ', num2str(smod.updatefac), ...
' Using \beta\prime factor decay = ', num2str(smod.beta2)],'fontsize',18);
elseif strcmp(Title,'basic')
title(['Surprise Values with decay \zeta = ', num2str(smod.decay), ' and update on \beta = ', num2str(smod.updatefac)],'fontsize',18);
else
title(Title,'fontsize',18);
end
axis([0 size(data,1) graphbottom graphtop]);
X = 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -