How to predict the output from a classifier model?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have used the classification learner to train image data using a SVM. The output shows it to be 95% and the confusion matrix looks as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/629750/image.png)
When I export the model and try to predict the Image features in matlab I get a confusion matrix as the one below, which seems weird and makes me believe I am doing something incorrect. Could someone please help?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/629755/image.png)
% Training Data
imset = imageSet('HOG\Train_Diff','recursive');
bag = bagOfFeatures(imset);
imageFeatures = encode(bag, imset);
signData = array2table(imageFeatures);
signData.signType = getImageLabels(imset);
% Test Data
imsetTest = imageSet('HOG\Test_Diff','recursive');
bagTest = bagOfFeatures(imsetTest);
imageFeaturesTest = encode(bagTest, imsetTest);
signDataTest = array2table(imageFeaturesTest);
signDataTest.signType = getImageLabels(imsetTest);
%% Classification
classificationLearner
%% Test Data Confusion matrix
model = trainedModel.ClassificationSVM;
predictedLabels = predict(model, imageFeaturesTest);
testLabels = signDataTest.signType;
plotconfusion(testLabels,predictedLabels)
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!