Is it possible to run the classification learner app in a loop?
Afficher commentaires plus anciens
I want my classification learner app to run with some generted data , but I keep having to do this again and again. Is there a way to run it with the generated data input using all classifiers and specifying the amount of cross-validation and finally export the results of all the classifier everytime I run.
1 commentaire
Shairyar Malik
le 17 Déc 2021
No one answered yet? I have the same question?
Réponses (1)
yes,sir,just as
method,we can see
clc; clear all; close all;
warning off all;
x = [1 1 1 1 2 2 2 2 3 3 3 3];
y = categorical(["dog" "dog" "dog" "dog" "cat" "cat" "cat" "cat" "bird" "bird" "bird" "bird"]);
funcs = {@fitcknn @fitcecoc @fitctree};
n_funcs_given = numel(funcs);
A = cell(1,n_funcs_given);
B = cell(1,n_funcs_given);
% loop for every model method
for i = 1:n_funcs_given
% model fit
A{i} = funcs{i}(x(:),y(:));
% cross val
crossval_i = crossval(A{i});
B{i} = kfoldLoss(crossval_i);
end
A
B
1 commentaire
Shairyar Malik
le 30 Déc 2021
Many thanks, yanqi liu
Catégories
En savoir plus sur Image Data Workflows dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!