Randomly Sample trajectories

Hi,

I wanted to know if it possible to randomly sample few trajectories from all the trajectories provided for a given mission?

Hi,

I found the simplest way to add it by adding one line as follows:

def sarsd_iter(self, num_epochs=-1, max_sequence_len=32, queue_size=None, seed=None, include_metadata=False, sample_no = -1):
.
.
.
   
# Setup arguments for the workers.
    if sample_no!=-1 and sample_no > 0:
       files = [(file_dir, max_sequence_len, data_queue, 0, include_metadata) for file_dir in data_list[0:sample_no]]
    files = [(file_dir, max_sequence_len, data_queue, 0, include_metadata) for file_dir in data_list]
.
.

Since data_list has the paths of all trajectories which are shuffled from this line

data_list = self._get_all_valid_recordings(self.data_dir)

files then would read randomly sampled required number of trajectories instead of reading all the files.

Let me know if you can add it to your code.