model_eval.m.svn-base

来自「Bayesian Surprise Toolkit for Matlab T.」· SVN-BASE 代码 · 共 37 行

SVN-BASE
37
字号
%MODEL_EVAL Compute the MSE for model testing
%   [Rval,Pass] = MODEL_EVAL(DATA,E_DATA,RMAX)
%
%   This is part of the model testing suite used to check the model before
%   (or even after) SVN update. It is given the expected data and the
%   actual data and returns the MSE along with a pass fail notation. 
%
%   RVAL is the MSE between the expected return and actaul return
%
%   PASS if the model passes by the margin set in RMAX then this is set to
%   1. Otherwise the test is considered a fail and it returns a 0.
%
%   DATA This should be the output data from the model being tested. 
%
%   E_DATA This should be the EXPECTED data from the model being tested. 
%
%   RMAX This should be a small number. Since there should be some expected
%   floating point error, this should not be 0. However, it should be very
%   small.
%
%
%   See also: model_test.m
%
%   T. Nathan Mundhenk
%   mundhenk@usc.edu

function [Rval,Pass] = model_eval(data,e_data,Rmax)

Rval = sum(sum((data - e_data) .* (data - e_data)));

if Rval > Rmax
    Pass = 0;
    fprintf('TEST FAILED: Result MSE %f\n',Rval);
else
    Pass = 1;
end

⌨️ 快捷键说明

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