?? nnpred.m
字號:
%#
%# function [ypred] = nnpred(topo,w1f,w2f,tablein,tableout,xnew)
%#
%# AIM: Prediction of responses of new samples with a neural network model.
%# The matrices of weights "w1f" and "w2f" can be obtained with the
%# function "nnmodel.m".
%#
%# PRINCIPLE: The optimal topology of the network (topo) must have been determined on
%# the calibration set. The training input and output data (xtrain and
%# ytrain) that were used to build the model must also be used to scale
%# the new data.
%#
%# INPUT: topo (2 x nh) : matrix containing topology of the NN (nh hidden nodes)
%# (H: hyperbolic tangent, L: linear, -: no function)
%# w1f (nh x (p+1)) : matrix of weights between input and hidden layer
%# w2f (1 x (nh+1)) : matrix of weights between hidden and output layer
%# tablein (mxtr x 2):input range-scaling parameters.
%# tableout (1 x 2): output range-scaling parameters.
%# xnew (nte x p) : matrix of inputs for the new samples
%#
%# OUTPUT: ypred (nte x 1) : vector of predicted responses
%#
%# SUBROUTINES: range.m : range-scaling of training, monitoring and test data
%# lmeval.m : estimation of responses with the final neural network model
%# invrange.mk : returns range-scaled data to original scale
%#
%# AUTHOR: Frederic Despagne
%# Copyright(c) 1997 for ChemoAC
%# Dienst FABI, Vrije Universiteit Brussel
%# Laarbeeklaan 103, 1090 Jette
%#
%# VERSION: 1.1 (28/02/1998)
%#
%# TEST: Krzysztof Szczubialka
%#
function [ypred] = nnpred(topo,w1f,w2f,tablein,tableout,xnew)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SCALING OF INPUT DATA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[mxtr] = size(tablein,1); % Size of the training input data
for i = 1:mxtr
% Range-scaling of test input data between -1 and 1
[xtes(:,i)] = rangenew(xnew(:,i),-1,1,tablein(i,:));
end
xte = xtes'; % Transposition of test input data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PREDICTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[yte1,yte2] = lmeval(topo,w1f,w2f,xte); % Estimation of test responses
ypred = invrange(yte2,0.2,0.8,tableout); % Inverse-scaling of estimated test responses
ypred = ypred';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -