Is it possible to run the classification learner app in a loop?
Show older comments
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 Comment
Shairyar Malik
on 17 Dec 2021
No one answered yet? I have the same question?
Answers (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 Comment
Shairyar Malik
on 30 Dec 2021
Many thanks, yanqi liu
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!