📄 test_esn.m
字号:
function outputSequence = test_esn(inputSequence, esn, nForgetPoints, varargin)% test_esn runs a trained ESN on a particular inputSequence% input args: % inputSequence: is a nTrainingPoints * nInputUnits matrix that contains % the input we will run the esn on% esn: the trained ESN structure % nForgetPoints: nr of initial time points to be discarded%% optional input argument:% there may be one optional input, the starting vector by which the esn is% started. The starting vector must be given as a column vector of% dimension esn.nInternalUnits + esn.nOutputUnits + esn.nInputUnits (that% is, it is a total state, not an internal reservoir state). If this input% is desired, call test_esn with fourth input 'startingState' and fifth% input the starting vector.%% ouput:% outputSequence is an array of size (size(inputSequence, 1)-nForgetPoints)% x esn.nOutputUnits% Created April 30, 2006, D. Popovici% Copyright: Fraunhofer IAIS 2006 / Patent pending% revision 1, June 6, 2006, H. Jaeger% revision 2, June 23, 2007, H. Jaeger (added optional start state input)if esn.trained == 0 error('The ESN is not trained. esn.trained = 1 for a trained network') ; endif nargin == 3 % case where no starting state is specified stateCollection = compute_statematrix(inputSequence, [], esn, nForgetPoints) ; else % case where the last (fourth and fifth) input argument gives a starting vector args = varargin; nargs= length(args); for i=1:2:nargs switch args{i}, case 'startingState', totalstate = args{i+1} ; otherwise error('the option does not exist'); end end stateCollection = ... compute_statematrix(inputSequence, [], esn, nForgetPoints, 'startingState', totalstate) ;endoutputSequence = stateCollection * esn.outputWeights' ; %%%% scale and shift the outputSequence back to its original sizenOutputPoints = length(outputSequence(:,1)) ; outputSequence = feval(esn.outputActivationFunction, outputSequence); outputSequence = outputSequence - repmat(esn.teacherShift',[nOutputPoints 1]) ; outputSequence = outputSequence / diag(esn.teacherScaling) ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -