scipy stats.rv_continuous() | Python Last Updated : 20 Mar, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report scipy.stats.rv_continuous() is a continuous random variable class which is meant for sub-classing. It is a base class for constructing specific distribution from continuous random variables. This class can't directly be used as a distribution. Parameters : moment : [int] moment calculation to use: 0 for pdf, 1 for ppf. Default = 1 a : [float] Lower bound for distribution. Default is -ve infinity. b : [float] Upper bound for distribution. Default is +ve infinity. xtol : [float] tolerance for fixed point calculation for ppf name : [str] Name of the instance. Used to construct the default e.g. for distributions badvalue : [object] Default is np.nan. Value in a result arrays that indicates a value that for which some argument restriction is violated. logname : [str] Used as part of theFirst line of the docstring. extradoc : [str] Used as the last part of the docstring shapes : [str] Shape of the distribution. Return : Continuous Random Variable Distribution. Code #1 : Using "rv_continuous class". Python3 1== def sample(self, size = 1, random_state = None): """ Return a sample from PDF - Probability Distribution Function. calling - rv_continuous class. """ return self._rv.rvs(size = size, random_state = random_state) Code #2 : Creating Gaussian Distribution from rv_continuous. Python3 1== from scipy.stats import rv_continuous import numpy as np class gaussian_gen(rv_continuous): '''Gaussian distribution''' def _pdf(self, x): return np.exp(-x**2 / 2.) / np.sqrt(2.0 * np.pi) gaussian = gaussian_gen(name = 'gaussian') x = 2.0 gaussian._pdf(x) Output : 0.05399096651318806 Comment More infoAdvertise with us Next Article scipy stats.rv_continuous() | Python V vishal3096 Follow Improve Article Tags : Python Python-scipy Python scipy-stats-functions Practice Tags : python Similar Reads scipy stats.cosine() | Python scipy.stats.cosine() is an cosine continuous random variable that is defined with a standard format and some shape parameters to complete its specification. Parameters : q : lower and upper tail probability x : quantiles loc : [optional]location parameter. Default = 0 scale : [optional]scale paramet 2 min read scipy stats.chi() | Python scipy.stats.chi() is an chi continuous random variable that is defined with a standard format and some shape parameters to complete its specification. Parameters : q : lower and upper tail probability x : quantiles loc : [optional] location parameter. Default = 0 scale : [optional] scale parameter. 2 min read scipy stats.frechet_r() | Python scipy.stats.frechet_r() is an Frechet right (or Weibull minimum) continuous random variable that is defined with a standard format and some shape parameters to complete its specification. Parameters : -> q : lower and upper tail probability -> a : shape parameters -> x : quantiles -> loc 2 min read scipy stats.fisk() | Python scipy.stats.fisk() is an fisk continuous random variable. It is also known as the log-logistic distribution, and equals the Burr distribution with d == 1 and is defined with a standard format and some shape parameters to complete its specification. Parameters : q : lower and upper tail probability x 2 min read scipy.stats.chi2() | Python scipy.stats.chi2() is an chi square continuous random variable that is defined with a standard format and some shape parameters to complete its specification. Parameters : q : lower and upper tail probability x : quantiles loc : [optional]location parameter. Default = 0 scale : [optional]scale param 2 min read Like