How do i fix error : 'model' parameter must be a character vector?
Afficher commentaires plus anciens
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 commentaires
Walter Roberson
le 15 Août 2019
Which MATLAB version are you using?
Bonaventura Sanjoyo
le 16 Août 2019
Réponse acceptée
Plus de réponses (1)
Xin Yee Tai
le 12 Août 2020
0 votes
Instead of 'sim', please try 'predict'.
Hope it helps!
3 commentaires
Walter Roberson
le 12 Août 2020
This is not correct. sim() is the correct function for patternnet()
Xin Yee Tai
le 12 Août 2020
Hi, thanks for correcting me. Could you please explain more about the different use between sim and predict? Thank you !
Walter Roberson
le 12 Août 2020
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!