I'm working on a side project which involves randomly generating neural networks using PyTorch. Issue is it's inefficient to randomly generate the sizes of the hidden layers if the input and output layers vary too much. So I have to kind of "scale" the sizes of the hidden layers as they reach the output layer while keeping the randomness part of it.
Let's say I have two numbers (1 and 20) and I wanted to make a list using a random number generator which picks through a range of numbers in between 1 and 20. But I also wanted to shift the probability of numbers being picked as it adds to that list.
So if it has already added 15 numbers, then the 16th number's probability for being the number 16 is much greater than its probability is for being number 1 so-to-speak - but if the code is adding the first number to the list, then its probability for being 1 is far greater.
myRange = [1, 20]
myList = generateRandList(1, 20)
print(myList)
[2, 2, 3, 4, 6, 3, 7, 6, 9, 10, 12, 11, 13, 12, 15, 16, 18, 16, 19, 20]
I was working with numpy.random.choice() and that does vary the probability of numbers being picked from a list, but not as it moves through the list.
Aucun commentaire:
Enregistrer un commentaire