finding accuracy for charector recognition using knn

2 views (last 30 days)
faceClassifier = fitcknn(trainingFeatures,trainingLabel);
%testing
kk=1;
for charector=1:47
for j = 1:test(charector).Count
queryImage = read(test(charector),j);
queryFeatures = extractHOGFeatures(queryImage);
actualLabel = predict(faceClassifier,queryFeatures);
actualLabel=char(actualLabel);
predictedLabel=test(charector).Description;
al(kk)=actualLabel(2:length(actualLabel));//error:Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
pl(kk)=predictedLabel(2:length(predictedLabel)) ;
iam doing charector recognition using knn, i used the above code for extracting features and classification ,when i tried to find out the accuracy of the classification i got an error(Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.) in one of the statement like above mentioned.Actually i have used 47 charectors that includes 47 folders one for each charector that is named charector1......charector47.Each folder contains around 200 different forms of writting.Hope anybody can suggest optimal solution that can solve the error

Answers (1)

Harsha Priya Daggubati
Harsha Priya Daggubati on 6 Apr 2020
Hi,
The error you mentioned is due to assignment you are trying to make. To be clear:
kk=1;
a= 1:10
al(1) = a(2:end);
The above code gives the same error too!
Assuming you wish to store all the actual and predicted labels, you can use cell array and store the values by appending to al in each iteration.
Hope this helps!

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!