String Class for Confusion Matrix
2 次查看(过去 30 天)
显示 更早的评论
Hi, my code is like below :
predictors = [apple apple watermelon watermelon orange orange];
validationPredictions = [apple apple apple apple orange apple];
confuseMatrix = confusionmat(predictors, validationPredictions);
Where :
- predictors = Class names (string data type) of data training.
- validationPredictions = Class names (string data type) as a result of classification.
What i know is, confusionmat need for integer value type for both of True Class and Predict Class.
I got error for running my code above, it seems the data must a integer but my classes is string. How to solve this?
If possible, i need a Confusion Matrix like this (taken from Classification Learner App Toolbox) :
2 个评论
Tom Lane
2016-5-19
If I run this right before your code:
apple = {'apple'}; watermelon = {'watermelon'}; orange = {'orange'};
then I get a matrix result with no error. How did you define these variables? What release of MATLAB are you using?
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!