This documentation is for astroML version 0.2

This page

Links

astroML Mailing List

GitHub Issue Tracker

Videos

Scipy 2012 (15 minute talk)

Scipy 2013 (20 minute talk)

Citing

If you use the software, please consider citing astroML.

11.2.2.4. astroML.density_estimation.EmpiricalDistribution

class astroML.density_estimation.EmpiricalDistribution(data)

Empirically learn a distribution from one-dimensional data

Parameters :

data : one-dimensional array

input data

Notes

This function works by approximating the inverse of the cumulative distribution using an efficient spline fit to the sorted values.

Examples

>>> import numpy as np
>>> np.random.seed(0)
>>> x = np.random.normal(size=10000)  # normally-distributed variables
>>> x.mean(), x.std()
(-0.018433720158265783, 0.98755656817612003)
>>> x2 = EmpiricalDistribution(x).rvs(10000)
>>> x2.mean(), x2.std()
(-0.020293716681613363, 1.0039249294845276)

Methods

rvs(shape) Draw random variables from the distribution
__init__(data)