confusion matrix for multinational regression analysis

5 visualizaciones (últimos 30 días)
Farzaneh Changizi
Farzaneh Changizi el 24 de Jun. de 2020
Respondida: Aditya Patil el 13 de Jul. de 2020
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

Respuestas (1)

Aditya Patil
Aditya Patil el 13 de Jul. de 2020
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)

Categorías

Más información sobre Support Vector Machine Regression en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by