Python scipy.stats.pareto() Examples

The following are 3 code examples of scipy.stats.pareto(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module scipy.stats , or try the search function .
Example #1
Source File: test_pareto.py    From chainer with MIT License 6 votes vote down vote up
def setUp_configure(self):
        from scipy import stats
        self.dist = distributions.Pareto
        self.scipy_dist = stats.pareto

        self.test_targets = set([
            'batch_shape', 'entropy', 'event_shape', 'log_prob',
            'mean', 'support', 'variance'])

        scale = numpy.exp(numpy.random.uniform(
            -1, 1, self.shape)).astype(numpy.float32)
        alpha = numpy.exp(numpy.random.uniform(
            -1, 1, self.shape)).astype(numpy.float32)
        scale, alpha = numpy.asarray(scale), numpy.asarray(alpha)
        self.params = {'scale': scale, 'alpha': alpha}
        self.scipy_params = {'scale': scale, 'b': alpha}

        self.support = '[scale, inf]' 
Example #2
Source File: test_pareto.py    From chainer with MIT License 5 votes vote down vote up
def sample_for_test(self):
        smp = numpy.random.pareto(
            a=1, size=self.sample_shape + self.shape).astype(numpy.float32)
        return smp 
Example #3
Source File: bootstrap.py    From resample with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _fit_parametric_family(dist: stats.rv_continuous, sample: np.ndarray) -> Tuple:
    if dist == stats.multivariate_normal:
        # has no fit method...
        return np.mean(sample, axis=0), np.cov(sample.T, ddof=1)

    if dist == stats.t:
        fit_kwd = {"fscale": 1}
    elif dist in {stats.f, stats.beta}:
        fit_kwd = {"floc": 0, "fscale": 1}
    elif dist in (stats.gamma, stats.lognorm, stats.invgauss, stats.pareto):
        fit_kwd = {"floc": 0}
    else:
        fit_kwd = {}

    return dist.fit(sample, **fit_kwd)