divideint divides the same way every time even when I place 'rng shuffle' before it.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Brent McWatters
am 21 Jul. 2020
Beantwortet: Asvin Kumar
am 6 Aug. 2020
Hi,
Code below returns the indices for each of those sets of data but the indices are always the same. How do I set it up so they are different each time?
Thank you,
Brent
rng shuffle;
[trainT,valT,testT] = divideint(nn_config.UnCleanLength,CONFIG.dataSplit.trainingFraction,CONFIG.dataSplit.validationFraction,CONFIG.dataSplit.testFraction);
0 Kommentare
Akzeptierte Antwort
Asvin Kumar
am 6 Aug. 2020
divideint uses a deterministic algorithm to partition the indices. You can use dividerand instead for a random partition of indices.
If you’re working with image/audio datastores, you can also use the splitEachLabel function. The documentation page has good examples.
If you’d like to do it without any existing function, you can do it as follows. This is similar to how it’s done in the YOLOv2 Object Detection example:
shuffledIndices = randperm(N);
idx = floor(0.6 * length(shuffledIndices) );
trainingIdx = 1:idx;
validationIdx = idx+1 : idx + 1 + floor(0.1 * length(shuffledIndices) );
testIdx = validationIdx(end)+1 : length(shuffledIndices);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Define Shallow Neural Network Architectures finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!