Neural Network Toolbox | Search  Help Desk |
trastd | Examples See Also |
Preprocess data using a precalculated mean and standard deviation
[pn] = trastd(p,meanp,stdp)
trastd
preprocesses the network training set using the mean and standard deviation that were previously computed by prestd. This function needs to be used when a network has been trained using data normalized by prestd. All subsequent inputs to the network need to be transformed using the same normalization.
trastd(P,T)
takes these inputs,
P - R
x Q
matrix of input (column) vectors.
meanp - R
x 1
vector containing the original means for each input.
stdp - R
x 1
vector containing the original standard deviations for each input.
PN - R
x Q
matrix of normalized input vectors.
p = [-0.92 0.73 -0.47 0.74 0.29; -0.08 0.86 -0.67 -0.52 0.93]; t = [-0.08 3.4 -0.82 0.69 3.1]; [pn,meanp,stdp,tn,meant,stdt] = prestd(p,t); net = newff(minmax(pn),[5 1],{'tansig' 'purelin'},'trainlm'); net = train(net,pn,tn);If we then receive new inputs to apply to the trained network, we will use
trastd
to transform them first. Then the transformed inputs can be used to simulate the previously trained network. The network output must also be unnormalized using poststd.
p2 = [1.5 -0.8;0.05 -0.3]; [p2n] = trastd(p2,meanp,stdp); an = sim(net,pn); [a] = poststd(an,meant,stdt);
pn = (p-meanp)/stdp;
premnmx
,
prepca
,
prestd
,
trapca
,
tramnmx