Is it possible to run the classification learner app in a loop?
이전 댓글 표시
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
Shairyar Malik
2021년 12월 17일
No one answered yet? I have the same question?
답변 (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
Shairyar Malik
2021년 12월 30일
Many thanks, yanqi liu
카테고리
도움말 센터 및 File Exchange에서 Support Vector Machine Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!