Main Content

prunedata

Prune data for consistency with pruned network

Syntax

[Xp,Xip,Aip,Tp] = prunedata(net,pi,pl,po,X,Xi,Ai,T)

Description

This function prunes data to be consistent with a network whose zero-sized inputs, layers, and outputs have been removed with prune.

One use for this simplification is to prepare a network with zero-sized subobjects for Simulink®, where zero-sized signals are not supported.

[Xp,Xip,Aip,Tp] = prunedata(net,pi,pl,po,X,Xi,Ai,T) takes these arguments,

netPruned neural network
pi

Indices of pruned inputs

pl

Indices of pruned layers

po

Indices of pruned outputs

X

Input data

Xi

Initial input delay states

Ai

Initial layer delay states

T

Target data

and returns the pruned inputs, input and layer delay states, and targets.

Examples

Here a NARX dynamic network is created which has one external input and a second input which feeds back from the output.

net = narxnet(20);
view(net)

The network is then trained on a single random time-series problem with 50 timesteps. The external input happens to have no elements.

X = nndata(0,1,50);
T = nndata(1,1,50);
[Xs,Xi,Ai,Ts] = preparets(net,X,{},T);
net = train(net,Xs,Ts);

The network and data are then pruned before generating a Simulink diagram and initializing its input and layer states.

[net2,pi,pl,po] = prune(net);
view(net2)
[Xs2,Xi2,Ai2,Ts2] = prunedata(net,pi,pl,po,Xs,Xi,Ai,Ts);
[sysName,netName] = gensim(net2);
setsiminit(sysName,netName,net2,Xi2,Ai2);

Version History

Introduced in R2010b

See Also

|