Save fitcsvms running in parfor loop
显示 更早的评论
Hello,
I have a code which I am trying to get running faster, it has 3 fitcsvm function. To do so (I cannot use the GPU) I decided to perform a parfor loop.
However, I cannot use the save function and if the save is outside the loop a 'variable not found' error occurs
parfor i = 1:3
if i == 1
SVM_tt = fitcsvm(features_dt(:,1:10),features_dt(:,11),...
'Standardize',true,'KernelFunction','RBF','BoxConstraint', tt_C, 'KernelScale',tt_sigma);
end
if i == 2
SVM_bb = fitcsvm(features_bp(:,1:10),features_bp(:,11),...
'Standardize',true,'KernelFunction','RBF','BoxConstraint', bb_C, 'KernelScale',bb_sigma);
end
if i == 3
SVM_ss = fitcsvm(features_swa(:,1:10),features_swa(:,11),...
'Standardize',true,'KernelFunction','RBF','BoxConstraint', ss_C, 'KernelScale',ss_sigma);
end
end
save('SVM_dt.mat','SVM_tt');
save('SVM_bp.mat','SVM_bb');
save('SVM_swa.mat','SVM_ss');
Without the parfor loop the code wors perfectly fine.
Thank you,
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!