How to load ANN trained model in a new matlab script

12 visualizaciones (últimos 30 días)
Muhammad Adam Syafiq Saridan
Muhammad Adam Syafiq Saridan el 19 de Jul. de 2020
Editada: Pranav Verma el 24 de Jul. de 2020

Respuestas (1)

Pranav Verma
Pranav Verma el 24 de Jul. de 2020
Editada: Pranav Verma el 24 de Jul. de 2020
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

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by