Randomly shuffle training data

I will explain how to shuffle the training data randomly.

Below is a Perl program that randomly shuffles and retrieves training data.

use strict;
use warnings;
use List::Util'shuffle';

#Index shuffle
my @indexes = (0 .. 9);
my @shuffled_indexes = shuffle @indexes;

#Get data assuming image information in random order
my @training_datas = ('a','b','c','d','e','f','g','h','j','k');
for my $index(@shuffled_indexes) {
  my $training_data = $training_datas [$index];
  print "$training_data\n";
}

A brief explanation of the Perl program that randomly shuffles and acquires training data

To shuffle the array randomly, use the Shuffle function of List::Util.

First create an index and shuffle it randomly.

Then, the training data is fetched using the randomly arranged indexes.

The training data itself may be shuffled, but I used an example of index shuffling so that it can handle multiple consecutive image information in binary.

Associated Information