フィルターのクリア

Uniform class probabilities vs. Empirical class probabilities

1 回表示 (過去 30 日間)
Diver
Diver 2015 年 11 月 7 日
コメント済み: Diver 2016 年 5 月 16 日
Hi;
I found on one Matlab example of Uniform class probabilities and Empirical class probabilities.
Empirical class probabilities is calculated as follows:
svmStruct = fitcsvm(X,Y); % X is training data and Y are classes
%%10-fold cross-validation
cvm = crossval(svmStruct);
%%Accuracy on cross-validated data
[yhatcv,S] = kfoldPredict(cvm);
% cross-validated error with empirical class probabilities
empirical_error=mean(Y~=yhatcv)
Uniform class probabilities is calculated as follows:
% cross-validated error with uniform class probabilities
uniform_error=kfoldLoss(cvm)
Could you pleas give me a formal definition of those 2 errors types?

採用された回答

Ilya
Ilya 2015 年 12 月 2 日
If you are still looking for an answer, there is only one definition for error. In each case, you form a confusion matrix and then take a weighted sum of off-diagonal elements. This code snippet should explain it:
load ionosphere
prior = [1 3]'/4;
m = fitcsvm(X,Y,'prior',prior,'kfold',5,'stand',1);
Yhat = m.kfoldPredict;
C = confusionmat(Y,Yhat,'order',m.ClassNames)
Coff = C;
Coff(1:3:end) = 0
sum(sum(Coff,2).*prior./sum(C,2))
m.kfoldLoss
  1 件のコメント
Diver
Diver 2016 年 5 月 16 日
@Ilya Thank you .. I think in this case I better use kfoldLoss error.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by