How to train fitcecoc on GPU and perform cross validation on the output model?

8 views (last 30 days)
I am using matlab function fitcecoc to build a multi class SVM classifier, using the following code line. Prior to running this function, I made the feature and label varaibles a gpuArray, to make sure mod_op was computed on a GPU.
options = statset('UseParallel',true);
mod_op = fitcecoc(feature, label, 'Coding','onevsall', 'Learners',template,...
'Options',options, 'PredictorNames', feat_nm, 'ResponseName', label_nm);
cr_val = crossval(mdl, 'Options',options);
In the output variable mod_op.X and mod_op.Y has a dataype of gpuArray as well. I cannot use mod_op as input for functions like, crossval, resubPredict since this functions cannot handle gpuArray. crosval as this throws up error, because somewhere down crossval uses grp2idx function which has a line 47 as:
[glevels,~,gidx] = unique(s,'first','legacy');
and unique can't use legacy with gpuArrays.
I want some help regarding how can I run fitcecoc on GPU and followingly use functions like, crossval, resubpredict on the output model?

Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!