- https://in.mathworks.com/help/stats/clustering.evaluation.silhouetteevaluation.html
- https://in.mathworks.com/help/stats/clustering.evaluation.daviesbouldinevaluation.html
Accuracy Calculation using confusionmat?
    3 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
Kindly I have an issue with accuracy calculation, please could you help ?
y_train = [ 1 1 1 4 4 3 3 5 5 5 ]; % for x_train
%x_test : has no true labels.
predictedLabel=[ 1 2 3 4 5 ]; %predicted lables for x_test
I used the code below :
group=y_train ; % 10
grouphat=predictedLabel; % for test 5 test data
C=confusionmat(group,grouphat);
Accuracy = sum ( diag (C)) / sum (C (:)) ×100;
but get error:
Error using confusionmat (line 75)
G and GHAT need to have same number of rows
I had error since the test data is more or less than the train ( no lables)?
 No true label for test data ( semi supervised learning )
Thank you
0 commentaires
Réponses (1)
  Spruha
 le 21 Avr 2025
        Hi Shawin,
I see you are encountering an error while using ‘confusionmat’. This issue arises because MATLAB’s ‘confusionmat’ function requires both input vectors—the true labels and the predicted labels—to have the same length and to correspond to the same set of data samples. Since you do not have the true labels for your test set, it is not possible to use ‘confusionmat’ to evaluate your results in this case.
Please refer to documentation of ‘confusionmat’ for more information: https://in.mathworks.com/help/stats/confusionmat.html 
Instead, you can consider using internal validation metrics such as the silhouette score or the Davies-Bouldin index.
Please refer to below documentation links to know about silhouette score and Davies-Bouldin index:
Hope this helps!
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

