How can I run ten times with randomized data by using imageDatastore ? And how to do cross-validation by imageDatastore?

1 view (last 30 days)

Hi, to test my project I split my data into data of train and data test... this is the code

[ImagesTrain,ImagesTest] = SplitData(ratio_App)

this is the code of function SplitData:

function [dataTrain,dataTest] = SplitData(ratio_App)
unzip(fullfile(matlabroot,'bin','ALLData.zip'));
data = imageDatastore('ALLData',...
    'IncludeSubfolders',true,...
    'LabelSource','foldernames');
[dataTrain,dataTest] = splitEachLabel(data,ratio_App);
dataTrain = shuffle(dataTrain);
end

I obtained the accuracy of my project 94% but when I want to validate it, I try to run my project 10 times by randomized data so I changed the function splitData like that:

function [dataTrain,dataTest] = SplitData(ratio_App)
    unzip(fullfile(matlabroot,'bin','ALLData.zip'));
    data = imageDatastore('ALLData',...
        'IncludeSubfolders',true,...
        'LabelSource','foldernames');
    [dataTrain,dataTest] = splitEachLabel(data,ratio_App,,'randomized');
    dataTrain = shuffle(dataTrain);
  end 

But by this function, I obtained accuracy in each run around 99% and 98% I don't understand why the results are not interpretable Could someone help me or show me where is the problem exactly??

Answers (0)

Categories

Find more on Data Import and Analysis 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!