If "classify" is supposed to be replaced by "fitcdiscr", why does it provide (better) different results?

1 次查看(过去 30 天)
in my code on the same data:
lda = fitcdiscr(meas(:,1:3),YN); is providing different (worse) results as
[j,err,P,logp,coeff_class] = classify([x y z],meas(:,1:3),YN);
coeff(1,2).linear are quite the same wheras the Const is significatly diffrent. What did I do wrong?
  1 个评论
Alain Kuchta
Alain Kuchta 2017-4-20
I understand that the constant term of the boundary equation for comparing group 1 to group 2 is different when using classify vs fitcdiscr
Please be more specific about why the results are better or worse, and give some summary of the data set you are using.
Based on the variable names I'm assuming you're using the Fisher-Iris data set. A quick test seems to indicate comparable classification since the difference in const is very small:
>> load fisheriris
>> Mdl = fitcdiscr(meas(:,1:3),species(:));
>> [~,err,P,logp,coeff] = classify([1 2 3], meas(:,1:3), species(:));
>> diff = Mdl.Coeffs(1,2).Const - coeff(1,2).const
ans=
-7.105427357601e-14

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by