why am i getting error with this code?
Ältere Kommentare anzeigen
testdata = readtable("testdata.xlsx");
predictions = char(trainedModel.predictFcn(testdata));
iscorrect=predictions==cell2mat(string((testdata.Character)));
iscorrect=iscorrect(:,2);
accuracy = sum(iscorrect)*100/30;
9 Kommentare
Fifteen12
am 8 Feb. 2023
What is the error you're getting? Without your test data it's difficult to replicate your issue.
Walter Roberson
am 8 Feb. 2023
Does the predictFcn of the trainedModel accept a table as input?
Why are you comparing only the second character of each predicted value against the table ?
Why are you dividing accuracy by the magic number 30 instead of by the number of rows in incorrect ?
Kregozt
am 8 Feb. 2023
Kregozt
am 8 Feb. 2023
Kregozt
am 8 Feb. 2023
Walter Roberson
am 9 Feb. 2023
accuracy = mean(iscorrect) * 100.
Walter Roberson
am 9 Feb. 2023
try
predictions = trainedModel.predictFcn(testdata);
and show us class(predictions) and size(predictions)
Kregozt
am 9 Feb. 2023
Walter Roberson
am 9 Feb. 2023
It would make it easier for us to advise you if you were to call
predictions = trainedModel.predictFcn(testdata);
whos predictions
and show us the output of the whos call.
Antworten (1)
Sulaymon Eshkabilov
am 8 Feb. 2023
0 Stimmen
Without looking at your data, it is diffiuclt to address your question properly. Thus, pl., post your sample data.
1 Kommentar
Kregozt
am 8 Feb. 2023
Kategorien
Mehr zu Pattern Recognition finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!