confusion matrix for multinational regression analysis

조회 수: 9 (최근 30일)
Farzaneh Changizi
Farzaneh Changizi 2020년 6월 24일
답변: Aditya Patil 2020년 7월 13일
I am a new user of MATLAB and I don't know much about it. recently, I have started with mnrfit. But now I have a problem with the output data of multinomial regression analysis that I need to have the output to use for confusion matrix:
confusionchart(trueLabels,predictedLabels)
I want to show confusion matrix. for multinomial regression results but this regression gives data such as B, P and errors.
I don't underestand now what should I put as input and output variables for confusion matrix. I have read the relevant information but still I don't know what to do
Thx

답변 (1개)

Aditya Patil
Aditya Patil 2020년 7월 13일
You can use mnrval to get the probabilities of each class. These probabilities can then be used to get class prediction, and those to get confusion matrix. Here's an example code.
% Load data
load fisheriris;
sp = nominal(species);
sp = double(sp); % We need labels for confusion matrix
% Fit and predict
[B,dev,stats] = mnrfit(meas,sp);
yhat = mnrval(B,meas,stats);
% convert probabilities to class output
[val, index] = max(yhat, [], 2);
confusionchart(sp, index)

카테고리

Help CenterFile Exchange에서 Support Vector Machine Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by