Issue
I'm trying to create a uniform distribution between two numbers (lower bound and upper bound) in order to feed it to sklearn's ParameterSampler. I am using scipy.stats.uniform in the following format:
from scipy.stats import uniform
params = ParameterSampler({'bandwidth':uniform(5,50)}, 20)
But when I get the random selections of the 'bandwidth' parameter, they are not all between 5 and 50. Some of them are bigger than 50 by a bit. So my question is what do the arguments in scipy.stats.uniform represent? Are they not a lower bound and upper bound? The documentation shows no arguments so I can't figure it out from that.
Solution
The first argument is the lower bound, and the second argument is the range of the distribution. So the example distribution in your question is uniform between 5 and 55.
Quoting from the documentation linked in your question:
A uniform continuous random variable.
This distribution is constant between
loc
andloc + scale
.
loc
is the first argument and scale
is the second argument.
Answered By - abeboparebop
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.