Home > vbmeg > functions > tool_box > linear_connectome_dynamics_toolbox > lcd_prediction_errors.m

lcd_prediction_errors

PURPOSE ^

COMPUTE PREDICTION ERROR

SYNOPSIS ^

function [nerr,nerr_ts,errors]=lcd_prediction_errors(Z,Zpred)

DESCRIPTION ^

 COMPUTE PREDICTION ERROR

 [Input]
 Z : original timeseries  [Nv Nt]
 Zpred : predicted timeseries [Nv Nt] 

 [Output]
 nerr : normalized square errors (error variance) [scalar]
 nerr_ts : time-point-wise normalized square error [1 Nt] 
 errors : error timeseries [Nv,Nt]

 2016/03/24 O.Yamashita
 * [Add] add nerr_ts as output
 2016/02/02 O.Yamashita

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [nerr,nerr_ts,errors]=lcd_prediction_errors(Z,Zpred)
0002 % COMPUTE PREDICTION ERROR
0003 %
0004 % [Input]
0005 % Z : original timeseries  [Nv Nt]
0006 % Zpred : predicted timeseries [Nv Nt]
0007 %
0008 % [Output]
0009 % nerr : normalized square errors (error variance) [scalar]
0010 % nerr_ts : time-point-wise normalized square error [1 Nt]
0011 % errors : error timeseries [Nv,Nt]
0012 %
0013 % 2016/03/24 O.Yamashita
0014 % * [Add] add nerr_ts as output
0015 % 2016/02/02 O.Yamashita
0016 
0017 errors = Z - Zpred;
0018 nerr = sum(sum((Z(:,:)-Zpred(:,:)).^2))/sum(sum(Z(:,:).^2));
0019 nerr_ts = sum((Z(:,:)-Zpred(:,:)).^2,1)./sum(Z(:,:).^2,1);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005