Issue
I am trying to add Numpy Random seed to 150 to get the same results.
I tried
simulations = np.random.seed(simulations)
But got me a float error
# Generate sales samples
simulations = 10000
sales_sims = np.random.normal(sales_mean, sales_std, simulations)
print(sales_sims)
print("mean:", np.mean(sales_sims))
print("std:", np.std(sales_sims))
My question: How to set up Numpy random seed to my 10,000 simulations
Solution
Here’s a guide on setting the random state for numpy. What does numpy.random.seed(0) do?
np.random.seed(150) #set seed
sales_mean = 0 # replace with desired value
sales_std = 1 # replace with desired value
#Generate sales samples
simulations = 10000
sales_sims = np.random.normal(sales_mean, sales_std, simulations)
print(sales_sims)
print("mean:", np.mean(sales_sims))
print("std:", np.std(sales_sims))
Answered By - M. Small
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.