How to calculate accuracy, F1 score & entropy?

16 ビュー (過去 30 日間)
Durlov Rahman
Durlov Rahman 2021 年 8 月 23 日
回答済み: Ram Patro 2021 年 12 月 9 日
Here is my data ""
Now I have to split this dataset into 70% training set & 30% test set....
Then I have to calculate accuracy, F1 score & entropy using some classifiers. They are Decision tree, knn, svm
How can I do this? Please help
  1 件のコメント
Yazan
Yazan 2021 年 8 月 23 日
This is not a question, but rather an assignment. See Mathworks examples on the Statistics and Machine Learning Toolbox.

サインインしてコメントする。

回答 (1 件)

Ram Patro
Ram Patro 2021 年 12 月 9 日
The data you have provided does not contain class label information. When you have the class label vector 'classLabel', you can partition data using cvpartition function.
per = 10; % Training percentage
cv = cvpartition(classLabel,HoldOut=1-(per/100));
'cv.training' lists all the training location indices that you can use to partition the data. Similarly '~cv.training' lists all the testing location indices.
For classification, you can refer to the examples:
  • fitctree function for decision tree classifier.
  • fitcknn function for K- neareset neighbour classifier
  • fitcsvm function for binary models of SVM classification
  • fitcecoc function for multiclass models of SVM classification.
After obtaining your classification results, you can refer:

カテゴリ

Help Center および File ExchangeClassification Trees についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by