Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scipy.stats seed?

I am trying to generate scipy.stats.pareto.rvs(b, loc=0, scale=1, size=1) with different seed.

In numpy we can seed using numpy.random.seed(seed=233423).

Is there any way to seed the random number generated by scipy stats.

Note: I am not using numpy pareto because I want to give different values for scale.

like image 761
ashok Avatar asked Apr 15 '13 13:04

ashok


People also ask

What is RVS () in Python?

Exponential Distribution in Python stats module's expon. rvs() method which takes shape parameter scale as its argument which is nothing but 1/lambda in the equation. To shift distribution use the loc argument, size decides the number of random variates in the distribution.

What is RVS in Scipy stats?

rvs: Random Variates. pdf: Probability Density Function. cdf: Cumulative Distribution Function.

How do I import stats from Scipy?

In the above program, first, we need to import the norm module from the scipy. stats, then we passed the data as Numpy array in the cdf() function. To get the median of the distribution, we can use the Percent Point Function (PPF), this is the inverse of the CDF.

What is Scipy stats in Python?

stats ) This module contains a large number of probability distributions, summary and frequency statistics, correlation functions and statistical tests, masked statistics, kernel density estimation, quasi-Monte Carlo functionality, and more.


1 Answers

scipy.stats just uses numpy.random to generate its random numbers, so numpy.random.seed() will work here as well. E.g.,

import numpy as np from scipy.stats import pareto b = 0.9 np.random.seed(seed=233423) print pareto.rvs(b, loc=0, scale=1, size=5) np.random.seed(seed=233423) print pareto.rvs(b, loc=0, scale=1, size=5) 

will print [ 9.7758784 10.78405752 4.19704602 1.19256849 1.02750628] twice.

like image 117
Kelsey Avatar answered Oct 02 '22 17:10

Kelsey