Difference fitcecoc(<chosen model template>) and individidual multiclass model classifier (fitcnb, fitcknn, fitcdiscr, fitctree)

5 views (last 30 days)
Hello dear Matlab-Community,
I am wondering which is difference of fitting a multiclass classifier through "fitcecoc" or the individual model commands as shown above in the summary.
For example, is there a difference in the following commands?
%
mdl = fitcdiscr(X,Y,"OptimizeHyperparameters","all");
%
and
%
mdl = fitcecoc(X,Y,'Learners',tnb,"OptimizeHyperparameters","all");
%
I am looking foward to you reply!
Thank you:)

Answers (1)

Vaibhav
Vaibhav on 27 Sep 2023
Edited: Vaibhav on 27 Sep 2023
Hi Denys,
It is my understanding that the clarification is requested regarding the distinction between employing “fitcecoc” for fitting a multiclass classifier and using individual model commands like “fitcdiscr”.
Please find the difference below:
Approach:
  • fitcdiscr: Trains a single multiclass classifier directly, without decomposing the problem into binary subproblems.
  • fitcecoc: Uses the Error Correcting Output Codes (ECOC) approach, decomposing the multiclass problem into multiple binary subproblems
Number of Classifiers:
  • fitcdiscr: Trains a single multiclass classifier.
  • fitcecoc: Trains multiple binary classifiers, one for each binary subproblem.
Classification Strategy:
  • fitcdiscr: Uses the specified discriminant analysis algorithm to directly solve the multiclass problem.
  • fitcecoc: Solves the multiclass problem by combining the predictions of the binary classifiers trained for each subproblem.
Flexibility:
  • fitcdiscr: Provides a simpler and more straightforward approach when you want to use a specific discriminant analysis algorithm for multiclass classification.
  • fitcecoc: Offers more flexibility by allowing you to choose different binary classifiers and leverage their strengths for multiclass classification.
Performance:
  • fitcdiscr: Performance depends on the discriminant analysis algorithm chosen and its suitability for the problem.
  • fitcecoc: Performance can be influenced by the choice of binary classifiers and their ability to handle the binary subproblems effectively.
Interpretability:
  • fitcdiscr: Provides direct interpretability of the multiclass classification results.
  • fitcecoc: Requires interpreting the results of multiple binary classifiers to understand the multiclass classification outcome.
In summary, the main difference is that `fitcdiscr` trains a single multiclass classifier, while `fitcecoc` decomposes the problem into binary subproblems and trains multiple binary classifiers. This allows `fitcecoc` to potentially provide better performance by leveraging the strengths of individual binary classifiers. However, `fitcdiscr` is simpler and more straightforward if you want to train a single multiclass classifier using a specific discriminant analysis algorithm.
Please refer to the following documentations for more information:
Hope this help!
Regards,
Vaibhav

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!