I have a system by which the weighted selection of a position (index) on a continuous vector (i.e. 1:1:1000) alters the weights in the adjacent indices, making them less likely to be chosen in the next iteration:
In order to choose weighted random numbers from a distribution that continuously changes after each selection is made, my script ordinarily uses for-loop constructs in conjunction with datasample or a functionally equivalent vectorised approach (see: Weighted random numbers in MATLAB) to choose samples one-by-one - allowing for re-assesment of the weights after each number selection.
The need for for-loops seems inherent for this problem - however, I wanted to ask whether anybody has any creative solutions to this problem without use of loops as this proves a significant bottleneck to performance.
Aucun commentaire:
Enregistrer un commentaire