How to load ANN trained model in a new matlab script

9 次查看(过去 30 天)

回答(1 个)

Pranav Verma
Pranav Verma 2020-7-24
编辑:Pranav Verma 2020-7-24
The size of the data used to train and simulate the network must be same. From the information you provided, it seems that your training and simulation dataset sizes are different. You should find out the training dataset size and accordingly change your simulation data.
Below is an example simulating the same behaviour:
%NN trained using P as dataset
P = [0 1 2 3 4 5 6 7 8 9 10;
0 1 2 3 4 5 6 7 8 9 10];
T = [0 1 2 3 4 3 2 1 2 3 4];
net = newff([0 10; 0 10],[5 1],{'tansig' 'purelin'});
net.trainParam.epochs = 50;
net = train(net,P,T);
save('NN2.mat')
%Trained NN loaded and simulated with data of same dimension
load('NN2.mat')
%Simulation data
simdata = [0 1 2 3 4 8 6 7 8 9 10;
0 1 2 3 4 5 6 7 8 9 10];
input = sim(net, simdata)
Thanks,
Pranav Verma

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by