"Reference to non-existent field 'tutorial_data_path'", this error appears each time I run the code of my gradution project and I don't know how I can solved I tried a lot ..

Hi,I need help! "Reference to non-existent field 'tutorial_data_path'", this error appears each time I run the code of my gradution project and I don't know how I can solved it I tried a lot .. Thanks in advance

4 个评论

%%Classification using svm
%
% # For CoSMoMVPA's copyright information and license terms, #
% # see the COPYING file distributed with CoSMoMVPA. #
if ~cosmo_check_external('svm',false)
fprintf('No SVM implementation is available, skipping\n');
return
end
%%Define data
config=cosmo_config();
data_path=fullfile(config.tutorial_data_path,'ak6','s01');
data_fn=fullfile(data_path,'glm_T_stats_perrun.nii');
mask_fn=fullfile(data_path,'vt_mask.nii');
ds=cosmo_fmri_dataset(data_fn,'mask',mask_fn,...
'targets',repmat(1:6,1,10)',...
'chunks',floor(((1:60)-1)/6)+1)';
% remove constant features
ds=cosmo_remove_useless_data(ds);
%%Two class classification
ds_2class=cosmo_slice(ds, ds.sa.targets==2 | ds.sa.targets==5);
ds_2class_train=cosmo_slice(ds_2class,ds_2class.sa.chunks<=5);
ds_2class_test=cosmo_slice(ds_2class,ds_2class.sa.chunks>5);
pred2=cosmo_classify_svm(ds_2class_train.samples,...
ds_2class_train.sa.targets,...
ds_2class_test.samples);
fprintf('2-class accuracy %.3f\n', sum(pred2==ds_2class_test.sa.targets)/numel(pred2));
mx=cosmo_confusion_matrix(ds_2class_test.sa.targets,pred2);
imagesc(mx);
colorbar();
%%Four class classification
ds_4class=cosmo_slice(ds, ds.sa.targets>=2 & ds.sa.targets<=5);
ds_4class_train=cosmo_slice(ds_4class,ds_4class.sa.chunks<=5);
ds_4class_test=cosmo_slice(ds_4class,ds_4class.sa.chunks>5);
pred4=cosmo_classify_svm(ds_4class_train.samples,...
ds_4class_train.sa.targets,...
ds_4class_test.samples);
fprintf('4-class: accuracy %.3f\n', sum(pred4==ds_4class_test.sa.targets)/numel(pred4));
mx=cosmo_confusion_matrix(ds_4class_test.sa.targets,pred4);
imagesc(mx);
colorbar();
cosmo_config is expected to construct that information. That function is not provided by Mathworks: it is part of some third party software

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by