-
Notifications
You must be signed in to change notification settings - Fork 5
/
CalcRmse.m
37 lines (33 loc) · 1.11 KB
/
CalcRmse.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
% CalcRmse: calculate the rmse between predictions and OUTs
%
% [rmse AveErrNum] = CalcRmse( dbn, IN, OUT )
%
%
%Output parameters:
% rmse: the rmse between predictions and OUTs
% AveErrNum: average error number after binarization
%
%
%Input parameters:
% dbn: network
% IN: input data, where # of row is # of data and # of col is # of input features
% OUT: output data, where # of row is # of data and # of col is # of output labels
%
%
%Version: 20130727
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Deep Neural Network: %
% %
% Copyright (C) 2013 Masayuki Tanaka. All rights reserved. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [rmse AveErrNum] = CalcRmse( dbn, IN, OUT )
out = v2h( dbn, IN );
err = power( OUT - out, 2 );
rmse = sqrt( sum(err(:)) / numel(err) );
bout = out > 0.5;
BOUT = OUT > 0.5;
err = abs( BOUT - bout );
AveErrNum = mean( sum(err,2) );
end