So I want to know the position of the randomly named_tuples sampled by the random.choices
.
I sample it with a list of the same length and positions (memory, probabilities)
sample_indices = random.choices(self.memory, k=batch_size, weights=sample_probs)
Type of memory : <class 'list'>
Type of memory index 0 : <class 'memory.Transion'>
Type of sample_indices : <class 'list'>
Type of sample_indices index 0 : <class 'memory.Transion'>
However, if I try to use the usual way (self.memory[sample_indices]
) of finding its index I get this error :
TypeError: list indices must be integers or slices, not list
Is anyone familiar with similar features which allow for finding the index or?
Thanks