Correct way of using kfoldLoss

4 ビュー (過去 30 日間)
DG
DG 2017 年 10 月 7 日
コメント済み: Ali Yar Khan 2020 年 2 月 5 日
I am trying to do a crossvalidation using a K-nn classifier. In the past, I used cvpartition to achieve this, but I found kfoldLoss function recently and using it seems much easier.
So this is the code that I have where I am using fitcknn to classify breast data (from NIPS) and then want to do 10 fold CV. My question is that when I do kfoldLoss, is it running 10-fold CV where it re-trains and tests on CV partitioned data for each fold, or is using the trained fitcknn 'Mdl' and just using that same trained classifier again and again. And if it does knn again for each partition, do i need to use fitcknn for the complete data because that just seems of no use.
Mdl = fitcknn(breast.sel, breast.labels,'NumNeighbors', 3,'KFold',10);
kl = kfoldLoss(Mdl)

回答 (1 件)

Carl
Carl 2017 年 10 月 10 日
The documentation page below has a good explanation of how kFold* functions work on cross-validated models:
To answer your questions,
  1. kFoldLoss will use an already trained (cross-validated) model
  2. The loss is calculated on the validation data for each fold in the cross-validated model
  1 件のコメント
Ali Yar Khan
Ali Yar Khan 2020 年 2 月 5 日
i want to get the total test instances of each fold as well as no of misclassified and correct classified from the model how i can do that?

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

カテゴリ

Help Center および File ExchangeLinear Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by