MATLAB Answers

How can I change weights of inputs in Fitcecoc for every binary classifiers?

2 views (last 30 days)
Resul AZIZI
Resul AZIZI on 24 Jul 2020
Answered: Aditya Patil on 18 Aug 2020
Dear madam/ sir
I want to create a multiclass classifcation by fitcecoc function from the templates like templateTree. As you know for a k class problem fitcecoc create k binary classifiers. I am trying to give weights value to every inputs in this function. My problem is I want that for a specific input in every one of these binary classifiers this value have different weight. I use the following code:
load fisheriris
weights = [1:150;151:300;301:450]';
t = templateTree('Surrogate','on','Weights',weights);
te = templateEnsemble('GentleBoost',100,t);
Mdl = fitcecoc(meas,species,'Learners',t,'coding','binarycomplete');
the program doesn't show any error and run successfully but I am trying to acess the weight a every inputs in every binarylearners ((( Mdl.BinaryLearners{1, 1} )))
but I don't detect the weights of and specific data in this binary classifiers.
1- I want to know if it is possible to access these weights?(I dont mean the vector W in fitcecoc)
2- My code runs without problem I want to even if I can't access the weight does the program change the weights of input data as I want or not?
Thank you

  0 Comments

Sign in to comment.

Answers (1)

Aditya Patil
Aditya Patil on 18 Aug 2020
In this case, the binary learners are Trees, specifically CompactClassificationTree. A tree does not have weights. Instead, it has splits at each node. In case of continuous inputs, these split criteria can be accessed using the CutPoint property. See the following example,
load fisheriris
weights = [1:150;151:300;301:450]';
t = templateTree('Surrogate','on','Weights',weights);
Mdl = fitcecoc(meas,species,'Learners',t,'coding','binarycomplete');
learners = Mdl.BinaryLearners;
firstlearner = learners{1};
firstlearner.CutPoint
firstlearner.CutPredictor
The CutPoint property is read only, and hence it cannot be modified.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!