How to load ANN trained model in a new matlab script

13 ビュー (過去 30 日間)
Muhammad Adam Syafiq Saridan
Muhammad Adam Syafiq Saridan 2020 年 7 月 19 日
編集済み: Pranav Verma 2020 年 7 月 24 日

回答 (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 Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by