How do i fix error : 'model' parameter must be a character vector?
古いコメントを表示
Hi everyone, sorry for asking this silly question. since i'm really new in nn matlab, i'm having difficulties to implement nn in matlab. so that you all can understand the bigger picture of what trouble i might have come across, i'm gonna give it in details.
first that i have data in xls document, each xls document contain 24 rows of data with 3 parameters (perimeter, diameter and area) of fruit database. this data is already a post-processed image (from preprocessing i saved the data in excel). then i normalized the data,
data1 = data1';
max_data = max(max(data1));
min_data = min(min(data1));
[m,n] = size(data1);
data_norm = zeros(m,n);
for x = 1:m
for y = 1:n
data_norm(x,y) = 0.1+0.8*(data1(x,y)-min_data)/(max_data-min_data);
end
end
afterward i use patternnet to train my data so that it can identify what kind of fruit i input to the gui system. it roughly like this :
net.trainFcn = 'trainlm';
net = patternnet(100, 'trainlm');
net.trainParam.epochs = 1000;
net.trainParam.goal = 1e-5;
net.divideFcn = 'dividerand'; % num of data that'll be divide
net.divideParam.trainRatio = 70/100; % training set
net.divideParam.valRatio = 15/100; % validation set
net.divideParam.testRatio = 15/100; % testing set
net = init(net);
[net,tr] = train(net, data_norm,group);
y = sim(net, data_norm);
....
%then classification from input and net to get classification fruit class...
....
result = round(sim(y,sample));
....
switch result
case 0
class='Firm';
case 1
class='Ripe';
case 2
class='Overripe';
end
so, i assume that from normalising the data, making the shape of the data change. How do i fix this? i search it online on MATLABanswers forum and someone have the same problem (not really the same) and the suggestion is this
but when i try it, my nn doesn't want to run and didn't display the nntraintool. What should i do to fix it?
2 件のコメント
Walter Roberson
2019 年 8 月 15 日
Which MATLAB version are you using?
Bonaventura Sanjoyo
2019 年 8 月 16 日
採用された回答
その他の回答 (1 件)
Xin Yee Tai
2020 年 8 月 12 日
0 投票
Instead of 'sim', please try 'predict'.
Hope it helps!
3 件のコメント
Walter Roberson
2020 年 8 月 12 日
This is not correct. sim() is the correct function for patternnet()
Xin Yee Tai
2020 年 8 月 12 日
Hi, thanks for correcting me. Could you please explain more about the different use between sim and predict? Thank you !
Walter Roberson
2020 年 8 月 12 日
カテゴリ
ヘルプ センター および File Exchange で Deep Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!