How to load ANN trained model in a new matlab script

10 vues (au cours des 30 derniers jours)
Muhammad Adam Syafiq Saridan
Modifié(e) : Pranav Verma le 24 Juil 2020

Réponses (1)

Pranav Verma
Pranav Verma le 24 Juil 2020
Modifié(e) : Pranav Verma le 24 Juil 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

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by